aspose file tools
The moose likes Servlets and the fly likes Synchronizer Token example Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "Synchronizer Token example" Watch "Synchronizer Token example" New topic
Author

Synchronizer Token example

adeeb alexander
Ranch Hand

Joined: May 29, 2008
Posts: 255
Hi.
Someone please please provide a simple Synchronizer Token example to avoid duplicate form submission. I have searched a lot, only got example which uses some or the other Framework. I need the example in to implement only in servlet ie. without using any framework. Please help me out.




Thanks.
Adeeb
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 23645

There are a few approaches. The easiest is to set an attribute in the session when you display the form and remove it when you receive the form. If the attribute isn't there to delete, it is a duplicate submission.

Two related patterns/techniques:
1) Use JavaScript to disable the form button so the user doesn't click twice. (useful if users have dialup)
2) Use Post Redirect Get pattern so user hitting refresh doesn't submit the form again


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta
 
 
subject: Synchronizer Token example
 
Threads others viewed
Disable Button
Synchronization Token
How can you syncronize two requests from the same user in JSF?
How good is PRG (POST/REDIRECT/GET) pattern in avoiding duplicate form submission?
Synchronizer Token: for the J2EE pattern book authors ...
IntelliJ Java IDE

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture