wood burning stoves 2.0*
The moose likes Servlets and the fly likes Double Submission Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Double Submission" Watch "Double Submission" New topic
Author

Double Submission

James Lye
Greenhorn

Joined: Nov 12, 2004
Posts: 6
Hi,

I'm trying to prevent double submission of a html form.
I've implemented on the blocking of double clicks on the client end using javascript. Somehow the 2nd submit manages to go through and the Post request is sent to the server. I'm ignoring this for the moment because I'm implementing the "Synchronizer token" on the server side to catch double submissions as well.

On the 1st submit, the request is processed since the token is valid. While the server is processing the 1st request, (I used a Thread.sleep(10000) to simulate a long transaction), the request is submitted a 2nd time. According to my codes, the request will not be processed as the token is not valid.

However after successful processing of the 1st request (Thread.sleep(10000) ends), my servlet which is supposed to forward to a JSP to display the results of the transaction, will throw a
java.io.IOException: There is no process to read data written to a pipe.

I read from IBM's technote that this message is thrown when the client pressed Refresh, Back or Stop, or close their browser after making the request, but before receiving the response back from the server.

In this case, none of the buttons were pressed. It was simply a 2nd click on the submit button before the 1st click had completed processing. Has anyone encountered this problem before? Or has anyone successfully implemented the prevention of double submissions? I've tried almost everything I've read from the forums but it doesn't seem to be working.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
I think it's the same problem IBM described even though they didn't list doing another GET or POST as a possible cause. I can induce the problem in my WikiServer by doing very fast GETs. I have to tap-dance on the refresh button to get fast enough but you've got that 1 second sleep to simulate longer response time.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Double Submission
 
Similar Threads
Issues Using jQuery and Ajax to Facilitate Long-Running Processes
Idempotent Request
Form Resubmitting problem.
How do I use tokens to prevent user from multiple submission
Check to see if a button is clicked once or twice