aspose file tools*
The moose likes Servlets and the fly likes how to avoid multiple submit on form Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "how to avoid multiple submit on form" Watch "how to avoid multiple submit on form" New topic
Author

how to avoid multiple submit on form

Shakti Sharma
Ranch Hand

Joined: Dec 19, 2000
Posts: 60
I am trying to avoid multiple submit on form. I am using token pattern. I am able to catch the duplicate request and able to redirect it to error
Page, but my problem is even though page shows the error message but it keeps on waiting for further response, I don’t know for what it waits for after displaying the error page, my understanding is it waits for response of first request, if this is true then how to avoid this??
Mark Stein
Ranch Hand

Joined: May 20, 2002
Posts: 75
One way to stop multiple submits is from the page itself, using javascript. Initial a boolean value to false, and on submit, set it to true. Use that boolean as a test when you submit... this way you can limit the actual request to one.
MS
Ronald Francis
Ranch Hand

Joined: Aug 02, 2001
Posts: 30
MS , the Javascript fix doesn't work 100% .Have been working on this recently , and if you click fast enough , duplicate requests do go in.
Ronald Francis
Ranch Hand

Joined: Aug 02, 2001
Posts: 30
Shakti ,
The browser waits for the response of the most recent request ...Are you sure that you are sending in the error page in response to the last (most recent) request and not the second ?
My test implemention of the token pattern worked fine..
Cheers
ROnald
Shakti Sharma
Ranch Hand

Joined: Dec 19, 2000
Posts: 60
I agree with you that browser waits for most recent response, thats what is not happing here. When first request passed token check, second request fails at token check and I am redirecting it to error page. Borowser loads error page sucessfuly but keeps on waiting for further response.
Shakti Sharma
Ranch Hand

Joined: Dec 19, 2000
Posts: 60
That was problem with debug mode, I changed mode and its working fine.
Thanks
eric sato
Ranch Hand

Joined: Oct 01, 2002
Posts: 37
hi,
What i can suggest by using session control. Once the first submit being submitted, check the session whether is "TRUE" , if no, set the session object to "TRUE", else error.
Regards,
eric sato


If you can't change the direction the the wind, change your sail.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to avoid multiple submit on form