• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get the users current object after session time out

 
kalyan narra
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Guys,

I have a requirement like after the session time out how do we get the users previous page like suppose currently i am adding a user i put it my screen like that after certain period of time the session should be time out and the application shows login page. Again the user login to the application i need to show the same page where he was in before session time out.

Some one help me how could i get that user object

Thanks
Kalyan G
 
Karthik Jayachandran
Ranch Hand
Posts: 91
Android Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

You can create a HttpSessionListener, while sessionDestroyed() put the User's name/object in application scope/some db and the last page viewed.

And on the sessionCreated() just get the appropriate user.
 
kalyan narra
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rajan Jay wrote:
You can create a HttpSessionListener, while sessionDestroyed() put the User's name/object in application scope/some db and the last page viewed.

And on the sessionCreated() just get the appropriate user.


Hello Rajan,

Very Thanks for your prompt response.

Actually i need some more explanation form you. Still i am not clear how can i do this. Can you please provide me any reference links if you found any thing for the same.

Thanks,
Kalyan G
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Once the session is gone, the session is gone--you won't get the same user object instance.

The previous suggestion was to use a session listener (the docs of which are available by clicking on the word HttpSessionListener) to save some state to somewhere (a database, the application context, whatever) and when that user logs in again, use the persisted state to drop them back onto whatever page they were on before their session expired.

This implies you'd need to keep track of what they were doing/where they were throughout their use of the application, of course.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic