posted 22 years ago
HttpSessionBindingListener is implemented by session attributes.
HttpSessionAttributeListener instance is created by Web-Container, based on <listern> element in web.xml. For each <listern-class>, one listern instance is created.
Now you can see, if your session has 3 attributes, each of them implements HttpSessionBindingListener, you got 3 ***Binding listeners.
But if you only define one <listener-class> in web.xml, you only get one ***Attribute listener.
another important difference, HttpSessionAttributeListener monitors ALL Sessions in the web-app, whenver any session has an attribute added/removed/replace, the listener got notified.
HttpSessionBingListener only cares about itself. If itself is added into or removed from a session, it is notified.
Kyle Tang<br />SCJP 91<br />SCWCD 96<br />SCBCD 95