Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

elements sequence in web.xml

 
swapna rao
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

From 1.4 version there is schema document for web.xml. The XML is evaluated according to the schema document.

Thanks
 
swapna rao
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Shashidhar Yarabati
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I remember one of rancher told inner elements should be in order.
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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.



Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic