• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

How to get the users current object after session time out

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 93
Python Redhat Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
You got style baby! More than this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic