• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

The Order Is Matter In web.xml?

 
Ali Ragi
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a simple, but still confused question:The Order Is Matter In web.xml?, and do I have to rememerize the order as well for the exam?
The DTD for <web-app> tag is: <!ELEMENT web-app (icon?, display-name?, description?, distributable?, con-text-param*, filter*, filter-mapping*, listener*, servlet*, servlet-mapping*, ...)>
I am wondering whether I have to follow exact order as defined in DTD? e.g.: <description> can be ahead of <display-name>?, and what happen if I declare the <filter> section right after the <servlet> section in web.xml. I tried it, it seems running fine for the web app. Is it some of the tag order is matter, and some is NOT. If it is so, how do I know which one the order is matter? Any comments and help will be appreciated
 
Yi Meng
Ranch Hand
Posts: 270
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
order is important as per xml nature.
But i don't whether the exam will test on the order of elements, can anyone clarify on this? Kathy and Bert?
 
Ali Ragi
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, Yi Meng!
Now question about the JSP: (not the web.xml)
How about the order of the attributes in the JSP tag? I know the order of some attributes are NOT matter (maybe I am wrong), but I am not sure whether it applies to all of the attributes in the JSP tag. If some of the attributes order are matter, how can I tell which attribute should be in order? Thank you in advance for any comments
 
Yi Meng
Ranch Hand
Posts: 270
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ali Ragi:
Now question about the JSP: (not the web.xml)

The order of attributes in a jsp tag should be of no problem, i.e. order does not matter.
e.g.
<c:set var="name" scope="scope" value="expression"/>
and
<c:set scope="scope" var="name" value="expression"/>
are equivalent, it's just a matter of convention and the programmer's preference/habbit.
 
Ali Ragi
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Clear! Thanks again!
 
hover cheng
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is NOT very nice for the enforcement the sequence of elemnets defined in the web.xml and tld.
Previous version of web.xml and TLD are defined(validated) by DTD. This is the problem raised: DTD MUST specify the sequence of elements.
Since this version, servlet2.4 and jsp2.0, it has switched to XML Schema from DTD. As one of a lot of advantages of Schema over DTD, is that you can specify whether the element should be sequenced or not, as you need.
As far as I know, a lot of part of web.xml and TLD are NOT sequence sensitive now( as far as it is possible ). So, I think we need not to memory the annoying sequences anymore, just "feel" at which conditions the sequence must be needed. New tech is to help us rather than confuse us
 
Nilesh Nadiyana
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Is it for sure that the sequence doesnot matter? because while searching for examples and objectives, I did came across texts which mentioned about memorizing the sequence in which the elements appear in dtd's.. If not, thats good.. Any confirmation would be very helpful..
Regards,
Nilesh.
 
hover cheng
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Nilesh Nadiyana:
Hi,
Is it for sure that the sequence doesnot matter? because while searching for examples and objectives, I did came across texts which mentioned about memorizing the sequence in which the elements appear in dtd's.. If not, thats good.. Any confirmation would be very helpful..
Regards,
Nilesh.

Nilesh,
I am sure that the "top level" elements( directly under "web-app" ) in web.xml are not sequence sensitive now.
You know, sun's officers in charge of SCWCD beta are almost the same as those in charge of SCBCD ( am i right? ). As my experience from SCBCD exam, there is no question concerning element sequence at all. But, there do have a few questions asking the meaning of elements, one of them even quite tricky.
 
Ali Ragi
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The bad news is that in some situation, there are some dependency issues require the proper sequence order in the web.xml-complicated, and we have to know that. Hope some sun cert people can clearify this.
 
Ali Ragi
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, hover cheng;
I have a question regarding the filter chaining. The filter chaining sequence order is rely on the order of the <filter-mapping> sections in the web.xml, and is the "top level" elements (directly under "we-app"). As you said:
...I am sure that the "top level" elements( directly under "web-app" ) in web.xml are not sequence sensitive now..."
If that is the case, how do you define the sequence order of the filter chaining in web.xml in the new Servlet 2.4 spec? Just wondering
[ January 18, 2004: Message edited by: Ali Ragi ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic