Default Configuration
The default configuration loads pages in order of priority stated. And when
nothing is found it will respond with a 404.
Default Load Priority
1. index.html
2. index.html
3. index.htm
4. index.jsp
Example of the default WEB-INF/web.xml webapp config.
<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_3_1.xsd"
version="3.1">
<!-- No <weclome-file-list/> stated for the default config -->
</web-app>
Usage
Add the welcome-file-list tag element to your web-app element and state the pages you would like to load as your home page when no page is declared like the configuration below.
Load My Pages in Order of:
1. index.html
2. index.jsp
3. home.jsp
4. help.jsp
Example of stating your own WEB-INF/web.xml welcome-file-list.
<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_3_1.xsd"
version="3.1">
<!-- Make your own welcome-file load priority -->
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>home.jsp</welcome-file>
<welcome-file>help.jsp</welcome-file>
</welcome-file-list>
</web-app>
No comments:
Post a Comment