为什么 Tomcat 运行时默认打开 index.html 或 index.jsp?如何配置首页?


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

发布了369 篇原创文章 · 获赞 381 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/Regino/article/details/105521071