I repost my contribution to another recent
thread about the same matter:
I think the
Servlet 2.4 specs are a little confusing. They say in SRV.10.3.2:
"Listener classes are declared in the Web application deployment descriptor using the listener element."
which, I understand, means that all of the listeners must be declared in the DD.
But later, in SRV.15.1.10, the specs say:
"Events of this type are either sent to an object that implements HttpSessionBindingListener when it is bound or unbound from a session, or to a HttpSessionAttributeListener that has been configured in the deployment descriptor when any attribute is bound, unbound or replaced in a session."
which seems to indicate that HttpSessionBindingListener doesn't need (have) to be declared in the DD.
I really would appreciate any explanation.
What HFSJ say is that:
"...
HttpSessionActivationListener must be registered in the DD, since they are related to the session itself, rather than an individual attribute placed in the session"
What about ServletRequestListener or ServletRequestAttributeListener? I think they must be declared in the DD, but I dont know it for sure.