首先我们可以在项目的WEB-INF中的web.xml文件中配置项目的默认启动页面
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0">
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>
在这个welcome-file-list中可以配置多条welcome-file
Tomcat服务器启动的顺序也是按照这个列表的顺序从上到下依次查找显示的,只会显示找到的第一个页面.
注意:如果没有生效
如果我们更改完之后发现,我们的更改并没有实现,那么这个时候,我们就是忽略了tomact服务器里面的初始页面配置,
那么如果配置呢?
找到Tomcat的安装目录:
修改这个web.xml文件,在里面
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
同理一样去修改这个Tomcat的默认页面.