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 Clarify my doubt  in listeners 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 "Clarify my doubt  in listeners" Watch "Clarify my doubt  in listeners" New topic
Author

Clarify my doubt in listeners

Kannan Rajendran
Greenhorn

Joined: Jul 04, 2008
Posts: 2
Hi,

Can anyone let me know the answer of this question. Thanks in advance.

Which of the following listeners are not configured in the deployment descriptor? Select two choices.

a. ServletContextListener
b. ServletContextAttributesListener
c. HttpSessionAttributeListener
d. HttpSessionActivationListener
e. HttpSessionBindingListener
f. HttpSessionListener
Anand Bhatt
Ranch Hand

Joined: May 30, 2007
Posts: 189
From my knowledge correct choice is only one not two
HttpSessionBindingListener.
Correct, me if I am wrong.
Ravi Singh
Greenhorn

Joined: Jun 02, 2008
Posts: 26
Also HttpSessionActivationListner
Kunal Jag
Ranch Hand

Joined: Jun 08, 2008
Posts: 31
Which of the following listeners are not configured in the deployment descriptor? Select two choices.

a. ServletContextListener
b. ServletContextAttributesListener
c. HttpSessionAttributeListener
d. HttpSessionActivationListener
e. HttpSessionBindingListener
f. HttpSessionListener


Correct options are D and E. Like HttpSessionBindingListener, there's no need to configure the HttpSessionActivationListener implementation class in the DD.

Regards,


Kunal Jaggi<br />Author of <a href="http://www.tatamcgrawhill.com/html/titleDetail.jsp?isbn=9780070249103.html" target="_blank" rel="nofollow">"SCWCD Exam Guide"</a>, SCWCD 5 (exam 310-083 and 310-084), <a href="http://www.tatamcgrawhill.com/html/titleDetail.jsp?isbn=9780070249103.html" target="_blank" rel="nofollow">McGraw-Hill</a><br /><a href="http://javaevangelist.com/" target="_blank" rel="nofollow">http://javaevangelist.com/</a><br /><a href="http://www.oreillynet.com/pub/au/2669" target="_blank" rel="nofollow">http://www.oreillynet.com/pub/au/2669</a>
Fola Fadairo
Ranch Hand

Joined: Feb 16, 2004
Posts: 35
According to Head First Servlets and JSP, HttpSessionActivationListener must be registered in the DD because it is directly related to the session and not to an attribute. (2nd Ed. Page 256). HttpSessionBindingListener does not need to be registered.
Kunal Jag
Ranch Hand

Joined: Jun 08, 2008
Posts: 31
According to Head First Servlets and JSP, HttpSessionActivationListener must be registered in the DD because it is directly related to the session and not to an attribute.


Please check the errata list of your favorite book.

Regards,
justine mills
Greenhorn

Joined: May 28, 2007
Posts: 6
the errata :
[b]
Change the title to "You do NOT configure ALL session listeners in the DD!"[/b]


looks confusing. At first glance, i take it that ALL session listeners do not need any DD configuration!
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Check that FAQ.


[My Blog]
All roads lead to JavaRanch
Abdul Rahman
Ranch Hand

Joined: Jul 04, 2008
Posts: 63
HttpSessionActivationListener
HttpSessionBindingListener

These two listeners do not need to be configured in the deployment descriptor.

Here's an excerpt taken from David Bridgewater's post in javaranch (http://www.coderanch.com/t/170002/Web-Component-Certification-SCWCD/certification/HttpSessionActivationListener-configured-DD)
A part of the API doc for HttpSessionActivationListener:
"Objects that are bound to a session may listen to container events notifying them that sessions will be passivated and that session will be activated. A container that migrates session between VMs or persists sessions is required to notify all attributes bound to sessions implementing HttpSessionActivationListener."
It's the objects that do the listening (not the container) - so no need for a DD entry.

For the 2nd you know the answer.


Abdul
SCJP5, SCWCD5, [scwcd wall of fame]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Clarify my doubt in listeners
 
Similar Threads
Clarification
Are Session Activation Listeners configured in DD?
JavaBean Listener Naming Rules?
IBM 484
About Sessions