• Post Reply Bookmark Topic Watch Topic
  • New Topic

submitting

 
Kinga Cserveny
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone suggest a secure way of stopping the user from re-submitting a jsp page. I am currently using a FormSubmit java script which has a boolean value which is set after one submittion, so will not do a submit again. Any other ideas would be very much welcom. Thank you.
Kinga
 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kinga.
I guess this topic has been discussed several times in javaranch. Anyways, what you can do is to use tokens. In an overview, you generate a random number and put in in your session object. When the user submits, you remove this value from the session. Now, if the user re-submits, the servlet will check if there's a token in the session value. The token will not be there because it was removed when the user submitted the first time, so the form will no be submitted again. Now, you can redirect this request to a "thank you" page or do whatever you want.
Hope this helps. You can also search the forum. You'll find similar questions.
cheers
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!