Implemented "SessionListener"
Blogging after a long time :)
Today I implemented Session Listener in our Project. Actually our requirement was to do certain database clean-up after the session time-out takes place. We could have called a Struts action when user clicks on Logout button, but the problem was - if the user closes the browser directly or forcefully closes the browser through Windows Task Manager, then how to call the clean-up code, so there was a need such that this code gets run by the server automatically after the session is about to time-out.
So I wrote a SessionListener class that implements HttpSessionListener. It's really a very cool concept that keeps track of each & every users' session. Even if you close the client browser, the required clean-up code will be fired automatically by the server itself & there you'll also have the access of that respective session data for that particular user :)
Any comments are always welcome :)
2 comments:
Very good!
Good article, good things, good feelings, good BLOG!
Post a Comment