It's not a secret anymore!
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
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

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
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é

Joined: Nov 24, 2005
Posts: 14688

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 ]

"Stay on the path."
I agree. Here's the link:
subject: need help on question on sessions
It's not a secret anymore!