File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes session expire with JSF Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "session expire with JSF" Watch "session expire with JSF" New topic

session expire with JSF

rashmi coorg

Joined: Jul 11, 2011
Posts: 19
In my jsf application i am making use of richfaces 3.. i track the user logged in and store the user-agent, user id and ip of the logged in system. this is done to prevent the user to login with same browser again with out loggin out. These details are stored in a map when the user loggs in and when user loggs out the entry for that user is removed from the map.. but if the sesssion expires i am not able to remove the user from the map as i am handling session expire with web.xml using the following code:
and in sessionExpired.jsp i am just redirecting the user to login page and here i will not be able to access any bean as the session is expired. so when session expires the user is blocked from loggin in again in same browser. i don't want this to happen. i want to remove the entry of the user from the map. how can this be done?
Kumaravadivel Subramani
Ranch Hand

Joined: Jul 05, 2008
Posts: 171

Is the map has stored in HttpSession object? ( hope so). If it is then create a class which implements HttpSessionListener and have you logic of inserting entry of logged user and remove entry in respective methods of sessionCreated() and sessionDestroyed(). It will work. Hope this will solve your problem.

No pain, No gain.
OCJP 1.6, Liferay Certified Developer 6.1
rashmi coorg

Joined: Jul 11, 2011
Posts: 19
thank you so much.. this works !!
I agree. Here's the link:
subject: session expire with JSF
It's not a secret anymore!