Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Session Listeners

 
Frank Beck
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When should the HttpSessionBindingListener be used versus the HttpSessionAttributeListener? I know I am missing something, but the two listeners seem somewhat repetitive. Is the Binding Listener based on the deprecated Value methods? I probably missed it but I have looked at the JavaDocs, the O'Reilly tutorial, and the Specs over the last couple of weeks. Thanks!
 
Craig Jackson
Ranch Hand
Posts: 405
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe it goes something like this. If a class implements the HttpSessionBindingListener, an object of that class will be notified when it is bound or unbound to the session.
If a class implements the HttpSessionAttributeListener, that object will be notified if any objects are added, removed or replaced in the session.
 
tony lee
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
The difference is that HttpSessionBindingListener can be implemented to notify any object, while HttpSessionAttributeListener is only used for attribute list.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!