1. 问题
- 为什么 Tomcat 运行时默认打开 index.html,或者 index.jsp?如何配置首页?
2. 解答
- 这个是 Tomcat 的 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.xml 文件配置即可。
<welcome-file-list>
<welcome-file>love.html</welcome-file>
</welcome-file-list>
- 补充说明:Tomcat 的安装目录下的 conf\web.xml 包含所有项目(模块)的配置信息,如果 IDEA 中的 web.xml 没有相关的配置信息,就运行 Tomcat 安装目录下的 conf\web.xml。
原文链接:https://qwert.blog.csdn.net/article/details/105521071