Sun Certified J2EE Architect for the J2EE Platform (Part 1)<br />Sun Certified Web Component Developer for the J2EE Platform<br />Sun Certified Programmer for the Java 2 Platform
Joined: Jan 23, 2002
Actually, I think I finally figured it out. Correct me if I am wrong. If I have an object aBook of type Book, then HttpSessionAttributeListener will send out a notification when an object has been added, replaced or removed from the session whereas HttpSessionBindingListener will send out a notification (as long as Book implements the HttpSessionBindingListener interface) when aBook has been bound or unbound from the session. Is this a correct?
Ricardo, this is a great question. The only comment I can add is when you alter a session-level object (add/modify/remove) and the object implements HttpSessionBindingListener, the container calls the valueBound method and then notifies the appropriate HttpSessionAttributeListener(s). I've also tried writing some sample code to fully understand the distinction, but so far, it hasn't caused the proverbial light to come on.