This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
HttpSessionBindingListener has got two methods valueBound() and valueUnbound(). This interface is implemented by an object that's an attribute. So that every time an instance of this object is Add/Removed to/from a session valueBound()/valueUnbound() will be called.
HttpSessionListener has two methods sessionCreated() and sessionDestroyed() and this interface is implemented by any class (doesn't have to be an attribute, but it can) and it will be called when a session is created or a session is destroyed.
so when a session is destroyed/invalidated/timedout etc the method HttpSessionListener.sessionDestroyed() will be called on a class that implements HttpSessionListener. Also if there is an object that has been added to the session and at the same time it implements HttpSessionBindingListener then valueUnbound() will be called.