File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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...
I agree. Here's the link:
subject: How to Handle back button
It's not a secret anymore!