This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes need help on question on sessions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "need help on question on sessions" Watch "need help on question on sessions" New topic
Author

need help on question on sessions

Niranjan Deshpande
Ranch Hand

Joined: Oct 16, 2005
Posts: 1277
4. Which of the following methods will be invoked on a session attribute that
implements appropriate interfaces when the session is invalidated? (Select one)
a sessionDestroyed of HttpSessionListener
b attributeRemoved of HttpSessionAttributeListener
c valueUnbound of HttpSessionBindingListener
d sessionWillPassivate of HttpSessionActivationListener
Answer: c
Explanation
The HttpSessionListener and HttpSessionAttributeListener are configured
in the deployment descriptor. Therefore, even if a session attribute implements
these interfaces, the sessionDestroyed() and attributeRemoved()
methods will not be called on that attribute.

in my opinion, the anwer is b - since the question asks "...invoked on a session attribute...."

also the explanation doesnt make any sense.

please explain.


SCJP 1.4 - 95% [ My Story ] - SCWCD 1.4 - 91% [ My Story ]
Performance is a compulsion, not a option, if my existence is to be justified.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Attributes implement HttpSessionBindingListener, not HttpSessionAttributeListener.
The question is about "methods will be invoked on a session attribute". So it will not be 'b'.


[My Blog]
All roads lead to JavaRanch
Rick Roberts
Ranch Hand

Joined: Apr 07, 2005
Posts: 59

The following class implements HttpSessionBindingListener which will allow it to be notified when added to a session as an attribute, or removed from a session.


[ October 18, 2006: Message edited by: Rick Roberts ]

SCJP
"Stay on the path."
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: need help on question on sessions