Method 1: (Suitable for setting up a single site in the server)
(d:demo is the site root directory)
In Tomcat, the default home page is: index.html, index.htm, index.jsp
If you need to use another page as the default homepage, you need to configure the web.xml file in the WEB-INF folder:
As in the above example:
Create the file web.xml in the D:demoWEB-INF folder:
The content is as follows:
<?xml version=”1.0″ encoding=”UTF-8″?>
<web-app version=”2.4″
xmlns=”http://java.sun.com/xml/ns/j2ee”
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
xsi:schemaLocation=”http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd ">
<welcome-file-list>
<welcome-file>hello.jsp</welcome-file>
</welcome-file-list>
</web-app>
Method 2: (The following settings will apply to all sites under this server) It is recommended to open the file conf/web.xml and find this 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>
Just add the file name you want in the middle.
For example: I want hello.jsp to be the default homepage, I change the above code to:
<welcome-file-list>
<welcome-file>hello.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>