Name

<welcome-file-list>

Synopsis

A welcome file is a file that the container serves when it receives a request URI that identifies a directory as opposed to a web page or a servlet. The <welcome-file-list> element can define an ordered list of files to look for in the directory and serve if present:

<welcome-file-list>
  <welcome-file>index.html</welcome-file>
  <welcome-file>index.htm</welcome-file>
  <welcome-file>default.html</welcome-file>
  <welcome-file>default.htm</welcome-file>
</welcome-file-list>

When a directory entry request is received that doesn’t match a servlet mapping, the container appends each welcome filename in the order specified in the deployment descriptor to the request URI and checks whether a resource in the WAR is mapped to the new URI. If it is, the request is forwarded to the resource. If no matching resource is found, the behavior is container-dependent. The container may, for instance, return a directory listing or an HTTP 404 status code (Not Found).

Get JavaServer Pages, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.