• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

J2ee certificate question

 
JayaSiji Gopal
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which listener interfaces can be implemented in order to receive events when objects are added to a session? [Select all correct answers]



1. javax.servlet.http.HttpSessionAttributeListener
2. javax.servlet.http.HttpSessionBindingListener
3. javax.servlet.http.HttpSessionListener
4. javax.servlet.http.HttpSessionActivationListener

I answered 2, but the answer is 1 & 2. y?
It says 'when objects are added to a session'.
 
Chandra Atla
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As the question is asking for all the events, both 1 & 2 are correct.

If you implement HttpSessionAttributeListener, you can get events when an attribute is added/removed or replaced from the session.

If you implement HttpSessionBindingListener, you can notifiy the object that it is being bound/un bound from the session. You can use the methods valueBound() and valueUnBound() to do this.

Thanks,
Chandra Atla
 
Bimal Patel
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Gopal,

You can refer to this thread for more on HttpSessionBindingListener.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic