• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Order of elements in web.xml

 
Ranch Hand
Posts: 219
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Ranchers,
It has been sometime that I am returning to Javaranch after I passed my SCJP2 with 93%. Completed my preparations and while I was doing some mock exams, I came to know some of the questions and I am going to participate this forum again. Hope I will get the some good response here, as I got it for my SCJP preparation.
Here goes the question.


<context-param>
<param-name>Parameter Value</param-name>
<param-value>Parameter Name</param-value>
<context-param>


Why it is not working when I change the order like this?


<context-param>
<param-value>Parameter Name</param-value>
<param-name>Parameter Value</param-name>
<context-param>


Is it true for all the web.xml elements?
 
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes the order of elements is important in web.xml as the file is parsed first when the context is initialized.If u see the tomcat logs it will show u a XML parse Exception or something-of-the-sort.
The elements are case-sensitive also.
 
author
Posts: 3252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The order, by the way, is dictated by the DTD. So any application server that uses a validating XML parser for the web.xml file will fail to deploy applications that do not have their XML elements in the right order.
I suggest you study the DTD and learn it by rote.
- Peter
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic