Tutorialspoint examples

Learn java tutorial with examples for beginners online

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="http://www.w3.org/2001/XMLSchema-instance" 
id="WebApp_ID" version="2.5">


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 
Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
		<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.


Download tutorialspointexamples Android App
Copyright © 2018 Tutorialspoint examples DMCA.com Protection Status