- 一个web站点的欢迎页面(没有指定任何“资源路径”的时候会默认访问欢迎页面)
-
在web.xml文件中进行了以下的配置:
<welcome-file-list> <welcome-file>login.html</welcome-file> </welcome-file-list> <!--注意:路径不需要以“/”开始,路径默认从webapp的根下开始找。-->
- 一个webapp是可以设置多个欢迎页面的:
<welcome-file-list> <welcome-file>page1/page.html</welcome-file> <welcome-file>page2/page.html</welcome-file> <welcome-file>login.html</welcome-file> </welcome-file-list> <!--注意:越靠上的优先级越高,找不到的继续向下找-->
- 配置方式:
- 一个是在webapp内部的web.xml文件中。(局部配置)
- 一个是在Tomcat的目录:apache-tomcat/conf/web.xml文件中进行配置。(全局配置)
-
<welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <!--注意原则:局部优先原则。-->
- 如果你一个web站点没有设置局部的欢迎页面,Tomcat服务器就会以index.html、index.htm、index.jsp作为一个web站点的欢迎页面。
servlet的web站点欢迎页面配置
于 2022-08-08 22:29:08 首次发布