Win a copy of Grokking Bitcoin this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

invalidate session when refreshed or backward pressed  RSS feed

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

How to make session invalid whenever refresh/backward button on jsp/servlets is pressed?
[ April 15, 2006: Message edited by: Bear Bibeault ]
 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by pramodh somashekara:
How to make session invalid whenever refresh/backward button on jsp/servlets is pressed?



I can not think of any way. How could we recognize on server whether its a refresh/back or a normal request?

What are you trying to do? May be there is other way around.
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We can use setHeader attributes where we can specify the no cache and expire time. With this two we can play around and get what you have asked. In this way we can restrict the user from go back to previous page or when refreshing we can get as a fresh request.

Hope this helps you if not do post the exact scenario.

regards
Magesh
 
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If each page should only be visited once, then you can keep a "flag" as
a session variable. i.e. when the page is opened, check if the session
variable exists. If so, throw an error and invalidate session as it has
already been visited. If it does not exist, create it and then continue on.

Of course, if his browser updates the page out of cache, you can't stop the
back or refresh (except by playing with the cache and expires pragmas as
listed earlier so that the browser has to request the page again).
[ April 18, 2006: Message edited by: Martin Simons ]
 
CAUTION! Do not touch the blades on your neck propeller while they are active. Tiny ad:
Create Edit Print & Convert PDF Using Free API with Java
https://coderanch.com/wiki/703735/Create-Convert-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!