• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Question related to order of elements inside Servlet element in DD

 
Ranch Hand
Posts: 211
Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Creator of Enthuware JWS+ V6
Posts: 3398
312
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 211
Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Frits

Regards,
Sagar
 
Sagar Shroff
Ranch Hand
Posts: 211
Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 3398
312
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Author
Posts: 836
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 211
Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank You Frits and Charles !!
 
Could you hold this puppy for a sec? I need to adjust this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic