aspose file tools*
The moose likes Struts and the fly likes How to get the users current object after session time out Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to get the users current object after session time out" Watch "How to get the users current object after session time out" New topic
Author

How to get the users current object after session time out

kalyan narra
Greenhorn

Joined: Sep 17, 2008
Posts: 10
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

Joined: Feb 18, 2009
Posts: 88


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

Joined: Sep 17, 2008
Posts: 10
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

Joined: Sep 29, 2008
Posts: 12617

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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: How to get the users current object after session time out