5.2. The Order of Elements within the Deployment Descriptor

Not only are XML elements case sensitive, they are also sensitive to the order in which they appear within other elements. For example, the XML header must be the first entry in the file, the DOCTYPE declaration must be second, and the web-app element must be third. Within the web- app element, the order of the elements also matters. Servers are not required to enforce this ordering, but they are permitted to, and some do so in practice, completely refusing to run Web applications that contain elements that are out of order. This means that web.xml files that use nonstandard element ordering are not portable.

Core Approach

Be sure to correctly order the elements that appear within ...

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.