Originally posted by Jeanne Boyarsky:
Sam,
Put a token, such as a randomly generated number, in the session when you display the page. The first time the user clicks save, check the request comes with a matching number and delete the token from the session. The second time the user clicks save, the token will not be in the session and you will know it was a duplicate request.
I thought of the same thing except a bit differently.
While in the servlet servicing the request:
- check the session for a "transaction" token
- if no token add one to the session and proceed
- else redirect to a "transaction in process" page
- remove transaction token when completed or when there is an exception
I would also use javascript as a complement to minimize redirection to the "transaction in process" page. Let's remember that once the second request is made, the response from the first request become undelivrable.
[ May 13, 2004: Message edited by: Brahim Bakayoko ]
SCJP, SCWCD, SCBCD, IBM CSD WebSphere v5, <br />A+, MCP 2000 and 2000 server, CST, and few incompleted certification tracks.<br /> <br />Ivory Coast<br /> <br />Analyze your web Request/Response @ <a href="http://webtools.servehttp.com" target="_blank" rel="nofollow">http://webtools.servehttp.com</a> down for a while...