File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Listener Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Listener Question" Watch "Listener Question" New topic

Listener Question

Sethu Prem

Joined: Aug 10, 2005
Posts: 6
Can somebody explain me the difference between
HttpSessionBindingListener and HttpSessionAttributeListener

1. Do they differ only by the object type they handle ?

2. Is there any order in which the listeners are invoked when a session
is being invalidated or being destroyed ?

Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026
An object of the class that implements HttpSessionBindingListener interface will be informed when it is added/deleted (bound/unBound) from the session.

An object of the class that implements HttpSessionAttributeListener interface will be informed whether an attribute has been added/removed/replaced from the session.

HttpSessionBindingListener will be invoked before HttpSessionAttributeListener when an Object is bound/unBound from the session.
[ October 05, 2005: Message edited by: vishnu prakash ]

Servlet Spec 2.4/ Jsp Spec 2.0/ JSTL Spec 1.1 - JSTL Tag Documentation
Sethu Prem

Joined: Aug 10, 2005
Posts: 6
Thanks for the explanation.
I agree. Here's the link:
subject: Listener Question
It's not a secret anymore!