• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Form Tokens

 
Nicolas Flammel
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a jsp form which has two html:submit buttons 'save' and 'save and add more'. Both submit the form data except that the save button loads another page and save and add more save the data but remains on that very page for more data to be inserted if needed.

I have used saveToken when coming to add page(which has these two buttons) to prevent resubmission of data when going back and clicking on save or when pressing F5.

How do I go about doing the same if one clicks on save and add more button.
If i use tokens then i am not able to save data for the second time when clicked on save and add more as the same page loads AND if i don't use token then pressing F5 after saving data for the first time would re submit the form and there would be duplicate data?
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Would resetToken on each call rectify this issue?
 
Nicolas Flammel
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
resetToken after performing the insertion does the work for first time only. After that even the save button doesn't submit the form data nor does save and add more.
 
forum guest
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like you are only reseting the Token in the prepare action that forwards to the JSP.


What you need is to reset and save the Token in the Action that the form submits to.

//save the new token
resetToken(request);
saveToken(request);
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic