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.


Please follow and like us:

Copyright © 2019 CodesJava Protection Status