In the servlet v2.3 specification, the web.xml DTD did in fact verify the proper tag ordering. However, in servlet v2.4 this ordering is no longer validated. My guess why this was done is to allow the developer to group related declarations together. For example, if you were to declare 20 <servlet> definitions and followed by 20+ <servlet-mapping> definitions, it might be confusing to read the DD. However, in v2.4 the developer can group the <servlet> and <servlet-mapping> declarations together. Thus enhancing readability of the DD.
posted 10 years ago
Thanks for the clarifcation Bryan!
Yes, the advantage what you mentioned is a worthy one. Also, if you consider the tag orderings inside a tag, like the one I mentioned there ... between the extension tag and mime-type ... there is no point in enforcing that extension should precede mime-type.
It infact poses more work on the deployer to remember and define it in proper order. This Makes the DD non-user-friendly.