Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

need help on question on sessions

 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Attributes implement HttpSessionBindingListener, not HttpSessionAttributeListener.
The question is about "methods will be invoked on a session attribute". So it will not be 'b'.
 
Rick Roberts
Ranch Hand
Posts: 59
Hibernate Java Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic