This week's book giveaway is in the Beginning Java forum.
We're giving away four copies of Murach's Java Programming and have Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Java Programming this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Epractice Lab review exam 2 : HttpSessionAttributeListener vs HttpSessionBindingListener  RSS feed

 
Himai Minh
Ranch Hand
Posts: 1552
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which interface must a class implement so that instances of the class are notified after any object is removed
from a session?
a. javax.servlet.http.HttpSessionAttributeListener
b. javax.servlet.http.HttpSessionListener
c. javax.servlet.http.HttpAttributeSessionListener
d. javax.servlet.http.HttpSessionBindingListener
Given answer A.

HttpSessionAttributeListener listener interface can be implemented in order to get notifications of changes to the
attribute lists of sessions within this web application.

I think the answer is d instead.
Here are the explanations from other ranchers:

it says any object. It it had said "objects of that particular class" then HttpSessionBindingListener would have been a better answer.


HttpSessionAttributeListener notifies SESSION about changes to attributes.
HttpSessionBindingListener notifies a CLASS INSTANCE about object binding (bound or unbound to session.)

Reference:
http://www.coderanch.com/t/557265/java-Web-Component-OCEJWCD/certification/Questions-HttpSession
http://www.coderanch.com/t/176926/java-Web-Component-OCEJWCD/certification/Listener
 
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender
Posts: 2945
208
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the answer is d instead.

Why? objects of a class that implements the HttpSessionBindingListener would be notified but not for "any object"...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!