aspose file tools*
The moose likes JSP and the fly likes invalidate session when refreshed or backward pressed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "invalidate session when refreshed or backward pressed" Watch "invalidate session when refreshed or backward pressed" New topic
Author

invalidate session when refreshed or backward pressed

pramodh somashekara
Ranch Hand

Joined: Jan 30, 2006
Posts: 62
Hi All,

How to make session invalid whenever refresh/backward button on jsp/servlets is pressed?
[ April 15, 2006: Message edited by: Bear Bibeault ]
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
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.
magesh karnam
Greenhorn

Joined: Sep 08, 2003
Posts: 14
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
Martin Simons
Ranch Hand

Joined: Mar 02, 2006
Posts: 196
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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: invalidate session when refreshed or backward pressed
 
Similar Threads
Doubt from the specs
Please explain me this!
Session Handling
EJBObject.getPrimaryKey()
WA #1.....word association