• 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
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

Controlling Session Timeout in JSP

 
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hii there...
I want to put some kind of Alert Popup on JSP Page that occurs when there is 10 minute left in session time out...let's say i have specified 30 min as session timeout in web.xml file.If user doesn't do anything for 20 mins ..then i want to pop up a alert (for example -- You are not doing anything so the session will expire in 10 mins )..How to do that ???
[ September 13, 2005: Message edited by: Bear Bibeault ]
 
author & internet detective
Posts: 41405
854
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bhavik,
When the page loads, start a timer in javascript. After 20 minutes, have it pop up an alert.
 
Bhavik Patel
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i don't want to put JUST an alert after 20 mins..i want to check and make sure no activity is done in last 20 mins and if that's the case pop an alert...
 
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
A filter that intercepts every request, and updates a timestamp in a session scoped bean would provide the server side to this solution.
Have your javascript function call a servlet that checks this bean after 20 minutes.

Of course the act of checking is, in itself activity.
It wouldn't be hard, though to exclude checks to to that servlet when updating the timestamp.
 
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
use session.getCreationTime() which gives the time the session was created. Add the max. session time to it and subtract 10mins from it and take that time as x. when this time x is reached give the pop-up.
 
Sheriff
Posts: 67682
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

i want to check and make sure no activity is done



What consititutes 'activity'? Moving the mouse? Client-side events?

What you're trying to do makes no sense to me since any non-client activity will extend the session timeout.
 
Squanch that. And squanch this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic