This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt in Listener

 
Gorkal Raghavendra
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whats the difference b/w HttpSessionAttributeListener and HttpBindingListener.
 
Dee Brown
Ranch Hand
Posts: 94
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An HttpSessionAttributeListener is normally implemented by an non-attribute class when an associated object needs to know that an attribute has been added to, replaced, or removed from a given session.

An HttpSessionBindingListener is normally implemented by an attribute class when an associated object needs to know that it is bound to or unbound from a session.
 
Kunal Jag
Ranch Hand
Posts: 31
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The key difference between HttpSessionBindingListener and HttpSessionAttributeListener is that in case of the former, a class itself receives notifications when it's bind to a session or unbind from a session object. Whereas, the HttpSessionAttributeListener is like a generic listener, which can be used to track all attributed which are added, removed or replaced in a session.


Regards,
[ July 04, 2008: Message edited by: Kunal Jag ]
 
vishalraju shah
Greenhorn
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
They both are declared differently,(This may appear in exam where you are gievn a exhibit and asked to choose which interface declaration is valid or not valid with given DD).

HttpSessionBindingListener doesn't need to be in DD (web.xml). Any object can implement this listener interface and provide impl. for valueBound and valueUnbound methods.

HttpSessionAttributeListener needs to be define in DD as and class has to provide impl. for it's methods.
<listener>
<listener-class>com.abc.MySessionAttributeListener</listener-class>
<listener>

They both share same event - HttpSessionBindingEvent.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic