Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Replace page after posting a form  RSS feed

 
aishwarya bhave
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
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!
Regards.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!