aspose file tools
The moose likes Servlets and the fly likes ServletContextListener Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "ServletContextListener" Watch "ServletContextListener" New topic


Saurabh Saha
Ranch Hand

Joined: Dec 08, 2004
Posts: 52
Hi All,
Please tell me what is ServletContextListener and where we use it. I know some little about it that we use this to add attribute on the context, so that all the servlets of this context can access this attribute, but it not so much clear to me, please clear my doubt.

Ben Souther

Joined: Dec 11, 2004
Posts: 13410

As it's name suggests, a context listener is an object that sits and listens for the startup and shutdown of a context.

It's a nice way to preform initialization before any servlets get instanciated and cleanup after they are destroyed.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Don't get me started about those stupid light bulbs.
subject: ServletContextListener