Saturday, February 25, 2012

web.xml -- welcome-file-list

<welcome-file-list> is a way to specify the default page a user will see.

For example, update your web.xml like this:
 <web-app>   
<welcome-file-list>
<welcome-file>welcome.html</welcome-file>
<welcome-file>index.html</welcome-file>
<welcome-file>home.html</welcome-file>
</welcome-file-list>
</web-app>

This means that web server will look for welcome.html / index.html / home.html in that order and display the first one it finds.

In your /web-content folder, create a file home.html, like this:
 <html>  
<body>
<p>Welcome to Confucius</p>
</body>
</html>

Build and deploy HelloWorld.war, the point your browser to:
http://localhost:8080/HelloWorld/

You will see the home.html page displayed.

No comments: