• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question related to order of elements inside Servlet element in DD

 
Sagar Shroff
Ranch Hand
Posts: 209
Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
source: http://www.javaprepare.com/scwd/quests/dd.html

# Which of these is true about deployment descriptors. Select the one correct answer.

1. The order of elements in deployment descriptor is not important. The elements can follow any order.
2. The elements of deployment descriptor are case insensitive.
3. The servlet-mapping element, if defined, must be included within the servlet element.
4. The web-app element must include the servlet element.

the correct answer is a.

I agree answer A is write according to what was mentioned in the SCWCD hints link,it says
Top level web.xml elements can appear in any order as compared to the servlet 2.3 specification. However, the order still matters within the elements inside the top-level elements - <servlet>, for example.

Now i just tested on tomcat 6 and it worked fine even if i put servlet-name element after servlet-class.Is this container specific ??

P.s Quick reply needed if possible.

Regards
Sagar.
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2536
113
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the Servlet 3.0 specs:
14.2 Rules for Processing the Deployment Descriptor
The sub elements under web-app can be in an arbitrary order in this version of the specification.


Regards,
Frits
 
Sagar Shroff
Ranch Hand
Posts: 209
Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Frits

Regards,
Sagar
 
Sagar Shroff
Ranch Hand
Posts: 209
Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But i am giving SCWCD5 so in that i guess it is mandatory !??? Also can someone Please let me know about this statement the oder of listeners is defined in DD ? i am not able to get this statement .
How ? i mean if there is session listener and context listeners they are always gonna be executed when the EVENT occurs.Tomorrow is my exam please let me know if possible



Regards,
Sagar.
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2536
113
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But i am giving SCWCD5 so in that i guess it is mandatory !???

This phrase "The sub elements under web-app can be in an arbitrary order in this version of the specification" is also there in the Servlet 2.4 specs.

Regards,
Frits
 
Charles Lyons
Author
Ranch Hand
Posts: 836
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The difference is whether your web.xml uses an older XML DTD doctype (where orders of elements are strict), or the newer XML Schema (ordering can be loose).

Java EE 1.4 onwards use the Schemas to define the XML content, and therefore the order is generally not important.
 
Sagar Shroff
Ranch Hand
Posts: 209
Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank You Frits and Charles !!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic