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.
“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