Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

session expire with JSF

 
rashmi coorg
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
<error-page>
<exception-type>javax.faces.application.ViewExpiredException</exception-type>
<location>/sessionExpired.jsp</location>
</error-page>
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
Posts: 171
Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
rashmi coorg
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you so much.. this works !!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic