Forums Register Login

Double Submit Problem

+Pie Number of slices to send: Send
Double Submit problem:

Two most frequently used HTTP request methods are GET and POST. GET method retrieves resource from a web server. Resource is identified by base location and optional query parameters. Generally, parameters of GET request are used to narrow the result and do not change server state. The same GET request can be sent to the server as many times as needed.

On the contrary, parameters of POST request usually contain input data, which can change state of server application. Same data submitted twice may produce unwanted results, like double withdrawal from a bank account or storing two identical items in a shopping cart of an online store. Submission of the same data more than once in a POST request is undesirable and got its own name: Double Submit problem.

It can happen when clicking "Reload" on a page that was generated by a POST, or when clicking "Back" takes you to a page that was generated by POST. In both cases the browser will generally issue a warning, but from that it's not clear whether it will or will not have bad consequences. So it's better to avoid the situation entirely. Another way to try to avoid double submits is to set a cookie on the first submit, and then issue a warning if a cookie exists if another submit is attempted. This, too, isn't infallible.

Micheal Jouravlev discussed the similar issue in his article Redirect After Post.

Bear Bibeault writes about the same issue in this JavaRanch Journal article

Also see PostRedirectGet
You totally ruined the moon. You're gonna hafta pay for that you know. This tiny ad agrees:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


You can read but need at least 5 cow(s) to post
This thread has been viewed 5165 times.
Similar Threads
How to take back the user to his personal page after a refresh
The browser's refresh button cause trouble
How to avoid duplicate submissions
session scope causing a problem
How to do this?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 00:41:17.