• Post Reply Bookmark Topic Watch Topic
  • New Topic

How do i implement HttpSessionListener?

 
sanjeev katthi
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do i implement HttpSessionListener??
[ July 17, 2007: Message edited by: Bear Bibeault ]
 
Manuel Leiria
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Create a listener class that implements the HttpSessionListener interface, and register the class in your deployment descriptor.

1 - Create a class that implements the HttpSessionListener interface. This interface defines two methods: sessionCreated( ) and sessionDestroyed( ), each of which accept a single HttpSessionEvent parameter.

2 - Make sure the implementing class has a zero-argument constructor.

3 - Place the compiled class in the WEB-INF/classes directory of your web application (including any of its package-related directories); or store the class in a JAR located in the WEB-INF/lib directory.

4 - Declare the listener in the web.xml deployment descriptor.

5 - Restart the web container (if necessary), which will instantiate your listener class and register it as a listener for all new sessions and session invalidations in the web application.
 
sanjeev katthi
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks manuel..
 
Manuel Leiria
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Glad to help.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!