×

Loading...
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。

How to create a WAR file

For each Web Application, there is a WEB-INF directory. Under this
directory, there are 1) web.xml; 2) \classes; 3) \lib and 4) tlds.
Under \classes, you can put all individual Java classes, incuding servlets and beans and other support classes; Under \lib, you can put .JAR file; Under \tlds, you can put all .TLD files. This is the convention. Pls do not break this convention. By following this convention, you DO NOT NEED set %CLASSPATH% for your Java classes.

It is not a good idea for you to add a layer called "\jsp" under
\WEB-INF\classes. I guess your examples work because you modified
the %CLASSPATH%. Evn=en your set-up works, please give it up.


My answer is based on TOMCAT 3.1 and 3.2. I am not sure what is the case in TOMCAT 4.0.
Report

Replies, comments and Discussions:

  • 工作学习 / IT技术讨论 / 两个问题,请高手指教
    1 在WIN2000下安装免费上网软件3web为什么不能成功,运行安装程序后什么反应也没有。是免费上网不支持WIN2000,还是机器设置需要修改?

    2 用TOMCAT+APACHE,JSP和SERVLET都没有问题,但是JAVABEANS不能成功,请问我应该将编译后的BEANS放在什么目录下呢?现在我的WEBAPP是自己设定的:D:\TOMCAT\WEBAPPS\JAVAPRACTICE。在此目录下有JSP(放JSP文件),WEB-INF(\CLASSES子下放SERVLET文件)两个子目录。

    多谢!
    • Examples in Tomcat use a lot of Beans. See how Beans work there.
    • ON your second question
      Let me say your Beans have a package structure "com.canada.practice".
      Tnhe, your Beans should reside at the following address:
      D:\TOMCAT\WEBAPPS\JAVAPRACTICE\WEB-INF\classes\com\canada\practice\
      • Dear Jabber, please come in
        For the beans which have a package structure "com.canada.practice".
        I put it in the following directory:d:\TOMCAT\webapps\javapractice\WEB-INF\jsp\beans\com\canada\practice\. And it works well. I put classes of servlets in d:\TOMCAT\webapps\javapractice\WEB-INF\classes.

        It is a little different from what you said. Is there any problem?

        Thank you!
        • How to create a WAR file
          For each Web Application, there is a WEB-INF directory. Under this
          directory, there are 1) web.xml; 2) \classes; 3) \lib and 4) tlds.
          Under \classes, you can put all individual Java classes, incuding servlets and beans and other support classes; Under \lib, you can put .JAR file; Under \tlds, you can put all .TLD files. This is the convention. Pls do not break this convention. By following this convention, you DO NOT NEED set %CLASSPATH% for your Java classes.

          It is not a good idea for you to add a layer called "\jsp" under
          \WEB-INF\classes. I guess your examples work because you modified
          the %CLASSPATH%. Evn=en your set-up works, please give it up.


          My answer is based on TOMCAT 3.1 and 3.2. I am not sure what is the case in TOMCAT 4.0.