posted 22 years ago
One of the solutions is to use a token. Before you display the JSP, create a random value (token), put it in the Session and place this value as a hidden value in your form.
when the user clicks the save button for the first time, your servlet will get the value from the hidden field (request.getParameter("myToken"))and compare it against your value in the Session. If the values are the same, remove your token from the session and process the data from the form (insert it to the DB).
Now , if the user hits the button again, you're application will try to compare again the value in the hidden field with the one in the session. Since you removed the value from the session, you know that the user pressed the button more than once, so you can discard that request and forward it directly to a thankyou.jsp, for example.
hope it helps..
I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury