• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

web.xml elements

 
Sandya Bhaskara
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is the order of elements in xml imortant?
i mean is this valid??
<context-param>
<param-value>....</param-value>
<param-name>...</param-name>
</context-param>


one more ques...
if u want to give more than one context param.how would u declare it?
<context-param>
<param-name>...</param-name>
<param-value>....</param-value>
</context-param>
<context-param>
<param-name>...</param-name>
<param-value>....</param-value>
</context-param>

or
<context-param>
<param-name>...</param-name>
<param-value>....</param-value>

<param-name>...</param-name>
<param-value>....</param-value>
</context-param>

what about listeners?
 
Welsh Ding
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1.I don't know whether the order is sensitive, sorry.

2.if there more than one context init parameter, you should write like this:
<context-param>
<param-name>...</param-name>
<param-value>....</param-value>
</context-param>

<context-param>
<param-name>...</param-name>
<param-value>....</param-value>
</context-param>

one by one.
 
Shane Semanek
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am preparing for the SCWCD exam and had the same question. According to section SVR.13.2 of the Java Servlet Specification version 2.4, "the sub elements under web-app can be in any arbitrary order in this version of the specification". As far as the order of the context-param element, the XML Schema declares the context-param element to be of type param-valueType which lists the elements in the order <param-name> followed by <param-value>. So, if the Deployment Descriptor where validated against the XML Schema, the following would be valid:

<context-param>
<param-name>test</param-name>
<param-value>TestParam</param-value>
</context-param>

and the following would be invalid:

<context-param>
<param-value>TestParam</param-value>
<param-name>test</param-name>
</context-param>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic