tomcat中的conf/web.xml里面
[code]
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
[/code]
如果客户端访问的URL指向的是一个目录,而不是一个文件名,那么tomcat会按照<welcome-file-list>指定的默认网页的顺序,依次在该目录中查找,将最先找到的文件发送给浏览器,并停止查找后面的网页文件.
WEB-INF中的web.xml文件
[code]
<web-app>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
[/code]
将覆盖上面的设置而不是对它增加
[code]
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
[/code]
如果客户端访问的URL指向的是一个目录,而不是一个文件名,那么tomcat会按照<welcome-file-list>指定的默认网页的顺序,依次在该目录中查找,将最先找到的文件发送给浏览器,并停止查找后面的网页文件.
WEB-INF中的web.xml文件
[code]
<web-app>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
[/code]
将覆盖上面的设置而不是对它增加
本文介绍了Tomcat服务器中welcome-file-list配置的作用及优先级。当客户端请求目录而非具体文件时,Tomcat会按列表顺序查找默认首页。WEB-INF/web.xml中的配置可以覆盖conf/web.xml中的设置。

被折叠的 条评论
为什么被折叠?



