• 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

Warning on session time out

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
How do I give a warning message when Session times out for a user. I am using Java Webserver 2.0.
Thanks
Santosh
 
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
In your control logic you can call:
request.getSession(false);
this will return null if no session is associated with the request and depending on the result of this you can redirect the user to a session timeout page.
Thanks,
Steve
 
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
and remember, HTML is stateless, so there's no way to contact the client WHEN their session times out. You can only notify them the next time they make a request to the application with the method Steve Granton mentioned.
Also, check out the HttpSessionBindingListener -- it allows you to do things on the server side when the session expires.
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And because you're using Java WebServer 2.0, you may run into a few problems.

If I remember correctly, sessionbinding stuff was a bit flakey when it was first introduced.
 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The Servlet 2.3 API makes it easier. Here's an older thread talking about it some - but it has links to dead threads there.
JavaPro has information on session listeners, among other cool additions in 2.3 API.
Of course, you'd have to move to a compliant app server.
---
[ April 19, 2002: Message edited by: Toby Davis ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic