所以我正在学习Web应用程序开发,我对如何在
eclipse for Dynamic Web Application提供的模板中组织我的文件感到困惑.
我应该将我的HTML页面放在WebContent中吗?我在哪里放置JSP和servlet源文件?全球遵循什么样的惯例?
这是eclipse提供的模板结构
>部署描述符
> JavaScript资源
> WebContent
> ECMAScript内置库
> ECMA 3浏览器支持库
> src
> JRE系统库
> Apache Tomcat v8
> Web App库
> EAR图书馆
>构建
> WebContent
> META-INF
> WEB-INF
> lib
将HTML和JSP页面放在WebContent目录中.
Eclipse帮助页面referenced by android-weblineindia声明WebContent是:
The mandatory location of all Web resources,including HTML,JSP,graphic files,and so on. If the files are not placed in this directory (or in a subdirectory structure under this directory),the files will not be available when the application is executed on a server. The Web content folder represents the contents of the WAR file that will be deployed to the server. Any files not under the Web content folder are considered development-time resources (for example,.java files,.sql files,and .mif files),and are not deployed when the project is unit tested or published.
所以浏览器所需的CSS文件和JS文件也应该放在这里.
将java源文件(包括servlet源)放在src目录中.相同的帮助页面为源目录指出了这一点(虽然它表明它被称为JavaSource,看起来像文档中的错误):
Contains the project’s Java source code for classes,beans,and servlets. When these resources are added to a Web project,they are automatically compiled and the generated files are added to the WEB-INF/classes directory. The contents of the source directory are not packaged in WAR files unless an option is specified when a WAR file is created.
如果你看项目属性 – >部署程序集您应该看到从src编译的文件部署到WEB-INF / classes,WebContent中的文件部署到WAR文件的根目录