Home Servlets ServletContextListener



ServletContextListener
Posted on: December 18, 2008 at 12:00 AM
ServletContextListener is a interface which contains two methods:

ServletContextListener

     

ServletContextListener is a interface which contains two methods:

  1. public void contextInitialized(ServletContextEvent event)
  2. public void contextDestroyed(ServletContextEvent event)

When we implement any interface then we have to implement its all methods. This listener will help a application to start and shutdown the events.

How  the ServletContextListener is useful:

1. ServletContextListener is notified when the context is initialized.

a). ServletContextListener gets the context init parameters from the ServletContext.

b). It stores the database connection as an attribute, so that the other components in the web application can access it.

2. It will be notified when the context is destroyed. It closes the database connection.

 

Related Tags for ServletContextListener:
clisttextinterfacemethodsservletmethodcontextintailistenertexcontainsexteliceinmntletacelistenmewhichsntextistlisttcorvservletcontextxttwssthstfaceetcetcodsono


More Tutorials from this section

Ask Questions?    Discuss: ServletContextListener   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.