From the servlet specification, i came to know that the order of top elements doesn't matter in web.xml i.e. we can have <servlet>,<servlet-mapping>,<security-constraint> in any order. What about the inner tags of these elements ? does the sequence matters for inner tags? Can we write like below: <servlet> <security-role-ref> </role-name> </role-link> </security-role-ref> <init-parm> <parm-name> <parm-value> </init-parm> <servlet-name> <servlet-class> </servlet>
Is this correct? If so,what is sequence rule for evaluataing web.xml.
you meant to say that the example which i gave is not correct as it doesn't follow the schema.But i found this sequence in one of the study notes of Java ranch site .This notes is uploaded by ashok.please anyone explain me.
I remember one of rancher told inner elements should be in order.
posted 12 years ago
As per Servlet version 1.4, the order of the inner elements are important. I had tested it long back. The tomcat did not complain about it. But the Sun Application Server give error if the elements are not in order. Then I check the schema document , I found that most of the inner elements enforced the sequence order.