File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes HttpSessionBindingListener Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "HttpSessionBindingListener Question" Watch "HttpSessionBindingListener Question" New topic

HttpSessionBindingListener Question

Arshad Azeem

Joined: Aug 21, 2005
Posts: 13

I wanted to know what would happen if you declare a listener say "HttpSessionBindingListener", in your Deployment Descriptor, also write the Listener class to implement the interface, but don't use the listener in any of your servlets.

I know what it does in one container, but in general, Is the implementation Container specific or does the servlet spec say anything about that?


Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
It's just an event listener which "automatically" intercepts on the in the javadoc mentioned events. You don't need to invoke it yourself or so, if you expected to do so. In the methods of the listener class which you override you just write the desired logic which should be executed during the in the javadoc explained event.

The application server implementation is supposed to actually instantiate the listener and execute the methods during the appropriate events.
Arshad Azeem

Joined: Aug 21, 2005
Posts: 13
I agree. Here's the link:
subject: HttpSessionBindingListener Question
It's not a secret anymore!