• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Epractice Lab review exam 2 : HttpSessionAttributeListener vs HttpSessionBindingListener

 
Himai Minh
Ranch Hand
Posts: 1361
7
  • 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
Saloon Keeper
Pie
Posts: 2533
113
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