JavaEE应用程序的文档根目录是什么?

时间:2022-07-23 23:05:59

This is from the Java EE6 Tutorial:

这来自Java EE6教程:

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.

Web模块具有特定结构。 Web模块的*目录是应用程序的文档根目录。文档根目录是存储XHTML页面,客户端类和存档以及静态Web资源(如图像)的位置。

The document root contains a subdirectory named WEB-INF, which can contain the following files and directories

文档根目录包含一个名为WEB-INF的子目录,该子目录可以包含以下文件和目录

But in here, it seems like the WEB-INF directory is not the document root. Also when you create a JSF Project using NetBeans, the folder structure will be like:

但在这里,似乎WEB-INF目录不是文档根目录。此外,当您使用NetBeans创建JSF项目时,文件夹结构将如下所示:

ProjectName
|
|
--src
|
|
--web
   |
   |
   --WEB-INF

which means the web directory again is not the document root?

这意味着web目录再次不是文档根目录?

So which is correct?

哪个是正确的?

Because in Java EE6 Tutorial, the text continues:

因为在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

文档根目录包含一个名为WEB-INF的子目录,它可以包含以下文件和目录类:包含服务器端类的目录:servlet,企业bean类文件,实用程序类,JavaBeanscomponents

But according to Netbeans, and the tutorial above, server side classes are in a different directory?

但根据Netbeans和上面的教程,服务器端类在不同的目录中?

Help with this confusion please?

请帮忙解决这个困惑吗?

1 个解决方案

#1


5  

The EE spec talks about the directory structure of your final war file. The directory structure you put in your question is how IDE arranges different files in its project structure. They are two different things.

EE规范讨论了最终war文件的目录结构。您在问题中添加的目录结构是IDE如何在其项目结构中排列不同的文件。他们是两个不同的东西。

To answer your question, the document root in the war is the parent directory of WEB-INF directory. Different IDE has different document root for the project structure, but in most cases, it is the parent directory of WEB-INF directory too. In the netbeans case, it is the web folder. In the standard Eclipse web project, it is the WebContent directory. In the maven world, it is the src/main/webapp directory. These are all configurable though in the IDE.

要回答您的问题,war中的文档根目录是WEB-INF目录的父目录。不同的IDE对项目结构有不同的文档根,但在大多数情况下,它也是WEB-INF目录的父目录。在netbeans的情况下,它是web文件夹。在标准的Eclipse Web项目中,它是WebContent目录。在maven世界中,它是src / main / webapp目录。这些都可以在IDE中配置。

#1


5  

The EE spec talks about the directory structure of your final war file. The directory structure you put in your question is how IDE arranges different files in its project structure. They are two different things.

EE规范讨论了最终war文件的目录结构。您在问题中添加的目录结构是IDE如何在其项目结构中排列不同的文件。他们是两个不同的东西。

To answer your question, the document root in the war is the parent directory of WEB-INF directory. Different IDE has different document root for the project structure, but in most cases, it is the parent directory of WEB-INF directory too. In the netbeans case, it is the web folder. In the standard Eclipse web project, it is the WebContent directory. In the maven world, it is the src/main/webapp directory. These are all configurable though in the IDE.

要回答您的问题,war中的文档根目录是WEB-INF目录的父目录。不同的IDE对项目结构有不同的文档根,但在大多数情况下,它也是WEB-INF目录的父目录。在netbeans的情况下,它是web文件夹。在标准的Eclipse Web项目中,它是WebContent目录。在maven世界中,它是src / main / webapp目录。这些都可以在IDE中配置。