According to Head First Servlets and JSP, HttpSessionActivationListener must be registered in the DD because it is directly related to the session and not to an attribute. (2nd Ed. Page 256). HttpSessionBindingListener does not need to be registered.
Joined: Jun 08, 2008
According to Head First Servlets and JSP, HttpSessionActivationListener must be registered in the DD because it is directly related to the session and not to an attribute.
Please check the errata list of your favorite book.
These two listeners do not need to be configured in the deployment descriptor.
Here's an excerpt taken from David Bridgewater's post in javaranch (http://www.coderanch.com/t/170002/Web-Component-Certification-SCWCD/certification/HttpSessionActivationListener-configured-DD)
A part of the API doc for HttpSessionActivationListener:
"Objects that are bound to a session may listen to container events notifying them that sessions will be passivated and that session will be activated. A container that migrates session between VMs or persists sessions is required to notify all attributes bound to sessions implementing HttpSessionActivationListener."
It's the objects that do the listening (not the container) - so no need for a DD entry.