Two Laptop Bag
The moose likes HTML, CSS and JavaScript and the fly likes Replace page after posting a form Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Replace page after posting a form" Watch "Replace page after posting a form" New topic

Replace page after posting a form

aishwarya bhave

Joined: Nov 23, 2003
Posts: 1
This is a probably a beginner question. I have a form in a.jsp to be posted to b.jsp.Once the form is submitted, I do not want the user to be able to go back to the a.jsp using the browser back button. I've tried using window.location.replace, in <form action = "window.location.replace(URL) method =" post"> and in the onClick of the 'Submit' button, but it seems as though I can only do one thing at a time,post the data(form fields and hidden fields) or disable the 'back' functionality.
Please help!
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
Best method is to have a cookie that remembers if the form has been submitted and it does not allow another submission.

There are other techniques that have been talked about on this forum.
I agree. Here's the link:
subject: Replace page after posting a form
It's not a secret anymore!