这是来自 Java EE6 Tutorial :
A web module has a specific structure. The top-level directory of a web module is the document root of the application. The document root is where XHTML pages, client-side classes and archives, and static web resources, such as images, are stored.
The document root contains a subdirectory named WEB-INF, which can contain the following files and directories
但是在here ,似乎 WEB-INF 目录不是文档根目录。另外,当您使用 NetBeans 创建 JSF 项目时,文件夹结构将如下所示:
ProjectName
|
|
--src
|
|
--web
|
|
--WEB-INF
这意味着 web 目录又不是文档根目录?
那么哪个是正确的?
因为在 Java EE6 教程中,文本继续:
The document root contains a subdirectory named WEB-INF, which can contain the following files and directories classes: A directory that contains server side classes: servlets, enterprise bean class files, utility classes, JavaBeanscomponents
但是根据 Netbeans 和上面的教程,服务器端类在不同的目录中?
请帮忙解决这个困惑?
最佳答案
EE 规范讨论了最终 war 文件的目录结构。您在问题中提出的目录结构是IDE如何在其项目结构中安排不同的文件。他们是两个不同的东西。
回答你的问题,war中的文件根目录是WEB-INF目录的父目录。不同的IDE对项目结构的文件根目录不同,但大多数情况下也是WEB-INF目录的父目录。在 netbeans 的例子中,它是 web
文件夹。在标准的 Eclipse Web 项目中,它是 WebContent
目录。在maven世界里,就是src/main/webapp
目录。这些都可以在 IDE 中配置。
关于java - JavaEE 应用程序的文档根目录是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15168854/