5.1. Defining the Header and Root Elements

The deployment descriptor, like all XML files, must begin with an XML header. This header declares the version of XML that is in effect and gives the character encoding for the file.

A DOCTYPE declaration must appear immediately after the header. This declaration tells the server the version of the servlet specification (e.g., 2.2 or 2.3) that applies and specifies the Document Type Definition (DTD) that governs the syntax of the rest of the file.

The top- level (root) element for all deployment descriptors is web-app. Remember that XML elements, unlike HTML elements, are case sensitive. Consequently, Web-App and WEB-APP are not legal; you must use web-app in lower case.

Core Warning

XML elements are ...

Get More Servlets and JavaServer Pages™ 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.