That's correct. The only listener you do not have to declare in the DD is the HttpSessionBindingListener.
Also, frankflysky java, you may want to change your name to abide by the JavaRanch Naming Policy before you attract the attention of a bartender!
“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” - Rich Cook
HttpSessionActivationListener should not be declared in the Deployment Descriptor.
as the container will call appropriate methods on the session attributes implementing the HttpSessionActivationListener on migration...
so conclusion is HttpSessionBindingListener & HttpSessionActivationListener should'nt be declared in the DD.
Joined: May 24, 2004
The following is from HFS&J, page 254: (emphasis mine)
You do NOT configure session binding listeners in the DD! If an attribute class (like the Dog class here) implements the HttpSessionBindingListener, the Container calls the event handling callbacks (valueBound() and valueUnbound()) when an instance of this class is added to or removed from a session. That's it. It just works. But this is NOT true for the other session related listeners on the previous page. HttpSessionListener, HttoSessionAttributeListener, and HttpSessionActivationListener must be registered inthe DD, since they're related to the session itself, rather than an individual attribute placed in the session.
I can understand the confusion regarding these two, especially if you read HF, because on page 182 it is vague as to whether or not HttpSessionActivationListener is implemented as its own listener class (like HttpSessionAttributeListener is) or implemented as an attribute class (like HttpSessionBindingListener is). My understand is that it is implemented as its own listener class, and therefore must be declared in the DD. I welcome comments from anyone who is more familiar with the interface, or perhapse had the time to write some test code.
Praveen Kumar Mathaley
Joined: Apr 14, 2003
HttpSessionActivationListener should'nt be declared in DD.. please refer the link Listener in DD
Joined: May 24, 2004
Thank you for the link Praveen. I appears that this is a common topic of discussion in this forum. I did a quick search and found 20+ topics regarding HttpSessionActivationListener dating back to 2001! Both the Specs and the HF book are rather vague in this matter, which I suppose is leading to much of the confusion out there.
So just so we are straight, HttpSessionBindingListener and HttpSessionActivationListener are both implemented as attribtues, and DO NOT need to be declared in the DD.