• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Listeners

 
Nikhil Jain
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ranchers,

Is the ordering of listeners & servlet tags important in DD. I was giving one of the mock examin javaranch., I came accorss such question that suguested, that the listenet tag should be used before servlet declarations. Is that any such rule?

<web-app>
<servlet>
.....
</servlet>
<listener>
<listener-class>com.javaranch.LogListener</listener-class>
</listener>
</web-app>

The above entry in the Deployment Descriptor(DD) will result in which of the following?

Explaining: The ordering of the DD is listener then servlet.
 
Amit Tayal
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think so.
I defined ServletContextAttributeListener after the servlet and it worked fine.

Amit
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The ordering of the DD is listener then servlet

This is true for Servlets 2.3. You're probably doing an old mock.

For SCWCD 1.4, this would not be true, as the order of elements is not important.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic