This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes listener tag in DD Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "listener tag in DD" Watch "listener tag in DD" New topic
Author

listener tag in DD

Deb Sadhukhan
Ranch Hand

Joined: Nov 05, 2003
Posts: 67
Is the order of listener and servlet tags matters in DD?

eg. is the following invalid?



_ __ _ __ _ __ _<br />SCJP 1.4 (95%) | SCWCD 1.4 (79%)<br />Artificial intelligence is no match for natural stupidity.
Bassam Zahid
Ranch Hand

Joined: Mar 09, 2005
Posts: 61
Yes the order is necessary. <listener> element precedes the <servlet> element.


BS<br />SCJP 1.4 88%<br />SCWCD 1.4 86%
Jose Esteban
Ranch Hand

Joined: Nov 28, 2004
Posts: 102
Originally posted by Bassam Zahid:
Yes the order is necessary. <listener> element precedes the <servlet> element.


Sorry Bassam, but I don't agree. According to Servlet spec 2.4, SRV.13.4:
"1. web-app Element
...
All sub elements under this element can be in an arbitrary order."

So the order doesn't matter under <web-app>
Ganeshji Marwaha
Greenhorn

Joined: Sep 16, 2004
Posts: 27
Originally posted by Jose Esteban:


Sorry Bassam, but I don't agree. According to Servlet spec 2.4, SRV.13.4:
"1. web-app Element
...
All sub elements under this element can be in an arbitrary order."

So the order doesn't matter under <web-app>


I agree with u Jose... I guess, this order thing has been made lenient starting from servlet spec 2.4. so, we can have elements within in any arbitary order... unless, u know that the order matters to u... like in the case of ordering of filter DD elements...


-- Ganeshji Marwaha<br />SCJP<br />SCWCD<br />SCBCD<br />MCP, MCP+SB, MCSD
Bassam Zahid
Ranch Hand

Joined: Mar 09, 2005
Posts: 61
Thanks Jose Esteban for indicating the error. It is really astonishing to know that order is not necessary. I think till Servlet 2.3 it was necessary. Am I right?
James Christian
Ranch Hand

Joined: Apr 04, 2005
Posts: 63
HFS on page 174 shows example of listener tag at the end of the DD so it seems that Jose's the man. Order is not important.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: listener tag in DD
 
Similar Threads
Listeners
error in JavaRange Mock
Question on Deployment descriptor - Order of Listeners and Servlets
Order Of Elements in Deployment Descriptor.
Is Question Bank ID : 52 Wrong?