If there is a HttpSessionAttributeListener declared in the DD, then the call back methods like attributeAdded() / attributeReplaced() etc will be called on this registered HttpSessionAttribute Listener.
If you want a particular object to be notified when it is added to the HttpSession, the the class of this object should implement HttpSessionBindingListener.
So, HttpSessionBindingListener is the right answer.
Hi, HttpSessionBindingListener is the correct answer to this: As specs says: "It Causes an object to be notified when it is bound to or unbound from a session. The object is notified by an HttpSessionBindingEvent object." Here bound and unbound itself mean added or removed.
Joined: Jun 06, 2008
Say you have this code:
Integer object = new Integer( 123 ); request.getSession().setAttribute( object );
Will it trigger a notification of any HttpSessionBindingListener, or a notification of HttpSessionAttributeListeners?