The first page the web application or website is called welcome page/home page. We can configure html file/JSP file/Servlet program as welcome files in “web.xml” file in as shown below web application launch welcome page automatically when request is given to web application directly.
In “web.xml” file under the web-app tag you configure the welcome files.
Configure Servlet programs
![]() |
Welcome file configuration |
When multiple welcome files are configure in web.xml file the server picks up the welcome file based on the order of configuration and availability. If no welcome files are configure in web.xml file the server looks to use “index.html” (or) “index.jsp” as default welcome file( if both are available “index.html” becomes default welcome file).
If explicitly configured welcome files are not available in web application and “index.jsp (or) index.html” files are available in web application, then the web application runs without welcome files.
If we want to configure Servlet program as welcome file follow these steps.
- Develop the web application and ready to deploy.
- Develop separate servlet program having welcome page logic.
- Configure the above servlet program(i.e. servlet program having welcome page logic).
- Configure the above servlet program as welcome file in web.xml using with URL Pattern.
Conclusion:
Prefer configuring JSP program/HTML program as welcome file. To make static web pages as welcome file use html program as welcome file. To make dynamic web pages as welcome files use JSP program as welcome file.