O'Reilly logo

JavaServer Pages, Second Edition by Hans Bergsten

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 Application Deployment Descriptor

A very important file is the WEB-INF/web.xml file. It is the application deployment descriptor that contains all configuration information for the application. If your application consists only of JSP and HTML files, you typically don’t need to worry about this file at all. But if the application also contains servlets or uses the container provided security mechanisms, you often need to define some configuration information in the web.xml file.

The deployment descriptor is an XML file. A standard XML Document Type Definition (DTD) defines the elements it can contain and how they must be arranged. Example F-1 shows a version of the complete[19] DTD but without the comments. All elements are instead described after the example.

Example F-1. Java Web Application Descriptor DTD

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <!ELEMENT web-app (icon?, display-name?, description?, distributable?, context-param*, filter*, filter-mapping*, listener*, servlet*, servlet-mapping*, session-config?, mime-mapping*, welcome-file-list?, error-page*, taglib*, resource-env-ref*, resource-ref*, security-constraint*, login-config?, security-role*, env-entry*, ejb-ref*, ejb-local-ref*)> <!ELEMENT icon (small-icon?, large-icon?)> <!ELEMENT small-icon (#PCDATA)> <!ELEMENT large-icon (#PCDATA)> <!ELEMENT display-name (#PCDATA)> <!ELEMENT description (#PCDATA)> <!ELEMENT distributable EMPTY> ...

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