Wednesday, September 26, 2007

Order of Elements in web.xml

Till today I have been thinking that the elements in the deployment descriptor (web.xml) need to be in a specific order.

But on checking the servlet specification I found an interesting point. The DTDs (i.e Servlet version 2.2 and 2.3) define the elements in a sequential fashion. But the Servlet version 2.4 which defines an XSD is more liberal and allows all the root but next elements, i.e, direct child of <web-app> element, to be in any order.

So, now we can have <servlet> anywhere inside <web-app> element.

References: Web.xml XSD, SRV 13.2 in Servlet 2.4 Specification

No comments: