Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsp web容器如何知道从何处获取默认页面?_Jsp_Tomcat_Web Applications - Fatal编程技术网

Jsp web容器如何知道从何处获取默认页面?

Jsp web容器如何知道从何处获取默认页面?,jsp,tomcat,web-applications,Jsp,Tomcat,Web Applications,我的Webapp位于$HOME/workspace/WebApp01中。如果我键入localhost:8080/WebApp01,浏览器/容器如何知道必须从$HOME/workspace/WebApp01获取index.html/index.jsp?您将web.xml描述符中的这些文件定义为欢迎文件。容器(Tomcat)的默认欢迎文件列表如下所示: <welcome-file-list> <welcome-file>index.html</welcome-f

我的Webapp位于
$HOME/workspace/WebApp01
中。如果我键入
localhost:8080/WebApp01
,浏览器/容器如何知道必须从$HOME/workspace/WebApp01获取index.html/index.jsp?

您将
web.xml
描述符中的这些文件定义为欢迎文件。容器(Tomcat)的默认欢迎文件列表如下所示:

<welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
</welcome-file-list>

index.html
index.htm
index.jsp
容器(Tomcat)用于决定加载哪个文件的规则如下:

  • 将按顺序检查欢迎文件列表中的文件列表
  • 如果未指定欢迎文件列表,则会按顺序检查服务器默认web.xml中的文件列表
  • 如果未找到合适的文件,并且启用了目录列表功能,则会显示目录列表
  • 如果禁用目录列表,则会发生404错误(这反过来可能会显示使用标记指定的页面)

  • 查看更多信息。

    但是,当您在浏览器中键入
    localhost:8080
    时,您没有指定Webapp01文件夹位于
    $HOME/worskspace
    内。那么,容器如何知道webapp驻留在
    $HOME/workspace/WebApp01
    中呢?