O'Reilly logo

Tomcat: The Definitive Guide, 2nd Edition by Ian F. Darwin, Jason Brittain

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

web.xml

The web.xml file format is defined in the Java Servlet Specification,[35] so this file format will be used in every servlet-conforming Java servlet container. This file format is used in two places in Tomcat: in the CATALINA_BASE/conf directory and in each web application. Each time Tomcat deploys an application (during startup or when the application is reloaded), it reads the global conf/web.xml followed by the WEB-INF/web.xml within your web application (if there is one[36]). As you'd expect, then, settings in the conf/web.xml file apply to all web applications, whereas settings in a given web application's WEB-INF/web.xml apply only to that application.

web-app

The root element of this XML deployment descriptor is web-app; its top-level elements are shown in Table 7-42. There are no required elements, but you should always have at least a display-name element for identification. As of the Servlet specification version 2.4, the elements nested directly under the web-app element may be listed in any order. In cases where more than one of the same element is used and it is unclear which element takes precedence, the servlet container will use them in the order they are listed in the web.xml file.

Table 7-42. Child elements of web-app

Element

Meaning

icon

A display file, for use in GUI administration tools.

display-name

Short name, for use in GUI admin tools.

description

Longer description.

distributable

Whether the web application can be load-balanced, i.e., distributed ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required