This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes JSP and the fly likes How to Handle back button Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "How to Handle back button" Watch "How to Handle back button" New topic

How to Handle back button

Sri Kor
Ranch Hand

Joined: Sep 03, 2001
Posts: 35
In web applications using JSP, Servlets how do we handle back and forward buttons of the browser.

SCJP2<br /> <br /><a href="" target="_blank" rel="nofollow">Share Your Personal Experiences</a>
Sam Smoot
Ranch Hand

Joined: Apr 18, 2002
Posts: 238
Those are managed by the browser and the history objects. You can't really disable them easily.

CNSS/NSA Infosec Professional,<br />Software Engineer
john hedden

Joined: Jul 20, 2002
Posts: 10
i looked at this a few weeks back and found out that: 1. train users not to use browser buttons or 2. use get instead of post. (haven't tried it out yet).
Shubhrajit Chatterjee
Ranch Hand

Joined: Aug 23, 2001
Posts: 356
Some java script trick....
<body on load = "javascript:history.forward(1)" >

Search the forum for a discussion, merits and demerits of this trick.

Sam Smoot
Ranch Hand

Joined: Apr 18, 2002
Posts: 238
The code should be

and is not a nice trick to play.. but it is effective...
wood burning stoves
subject: How to Handle back button