@WebListener public class SampleListener extends Object implements ServletContextListener
When the listener is linked to a context, it places a message on the log when the context is started and when it is stopped.
ServletContextEvent,
ServletContext,
WebListener| Constructor and Description |
|---|
SampleListener() |
| Modifier and Type | Method and Description |
|---|---|
void |
contextDestroyed(ServletContextEvent arg0)
Method to be executed when context is destroyed.
|
void |
contextInitialized(ServletContextEvent arg0)
Method to be executed when context is initialized.
|
public SampleListener()
public void contextDestroyed(ServletContextEvent arg0)
In this sample, it places a message in the log4j log file.
contextDestroyed in interface ServletContextListenerarg0 - event object describing destruction of contextpublic void contextInitialized(ServletContextEvent arg0)
This method places a message in the log4j log file.
contextInitialized in interface ServletContextListenerarg0 - context event describing initialization of context