Easy learning with example program codes

welcome-file-list in web.xml


The welcome-file-list attribute of web.xml file is used to define the list of welcome files.

Sample code of welcome-file-list attribute in web.xml:

  //other attributes
  //other attributes

How it works:

First web server looks for welcome-file-list if it exist then it looks for file defined in first welcome-file. If this file exists then control is transferred to this file otherwise web server will look at the next welcome file and so on.

If the welcome-file-list is not exists or files defined in welcome-file-list are not exists then server will looks at the default welcome files in following order index.html, index.htm, index.jsp, default.html, default.htm and default.jsp.

Default welcome file list:


Example of welcome-file-list:


<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="" 
id="WebApp_ID" version="2.5">


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 
Transitional//EN" "">
		<h1>This is a welcome file list program.</h1>  


servlet example 4
Download this example.
Next Topic: load-on-startup in web.xml with example.
Previous Topic: Deployment Descriptor: web.xml file with example.

Related Topics:

How to build java project using ant in eclipse?
JAXB marshalling – convert java object to xml example.
How to create pdf file in java using iText jar?
Generics class example.
OGNL in struts 2.
Hibernate One-to-One Mapping using xml.
Send inline image in email using JavaMail API.
Quartz 2 JobListener example.


Industrial Training

We offers Placement Oriented Training on Java, Spring, JSF, Hibernate, PHP, AngularJS, Angular 4, PLSQL, Oracle BI Publisher etc. We also provides Online training, please mail us at


We also provides the Development services for Website Development , Java Development, PHP Development, Android App Development etc. You can contact us on

Copyright © 2019 CodesJava Protection Status SiteMap Reference: Java Wiki