• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to return a page to infor client when the session time out ?

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,everyone:
I have seen on some web a page may return to browser when the session time out.I only know the HttpSessionListner has this function.but we often use a response to return page,from the listner we can get the session by the HttpSessionEvent,but how can I get the response?
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You don't need a listener for this.

When the user logs in, bind an object to session (let's call it 'userBean').
With every subsequent request, check for the existence of this object.
If request.getSession().getAttribute("userBean") is null then the user has either not logged in or has let their session time out.
In that case forward or redirect to the login page.

A filter makes it easy to put this checking fuctionality in front of every request without having to update all of your servlets.

I have an example app that does this on:
http://simple.souther.us/not-so-simple.html
Look for SessionMonitor
 
luxica peng
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
this is valuably.thanks,Ben.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic