On 5/11/05, Joe Germuska <[EMAIL PROTECTED]> wrote: > At 10:35 AM -0700 5/11/05, Michael Jouravlev wrote: > >On 5/11/05, Scott Purcell <[EMAIL PROTECTED]> wrote: > >> I am having trouble getting information, or a workaround for the > >>following problem. > >> > >> A user fills out a simple textfield form. I update the database > >>with the value and show a new jsp page. Then the user hits the > >>back-button, and even though the browser gives an alert (this will > >>POSTDATA that is expired as cache") yes or no? And they say yes, I > >>enter another record into my database. Causing problems. > >> > >> I have my nocache set to true in my struts-config.xml. Any other > >>ideas, solutions to this problem? > >> > >> Thanks, > >> Scott > > > >If you are looking how to detect double submit, then use tokens. If > >you want to get rid from double submits and from POSTDATA dialog, use > >redirection. > > > >To use redirection, submit your data with POST, process it, then > >redirect to the result page. User will be able to reload it without > >causing a resubmit. Of course, you would need to save the data and > >messages somewhere between requests, either in the session or you can > >stuff then into request as a bunch of query parameters. > > Michael: > > In Scott's case, the user is hitting the back button, not reloading > the result page. I think that even using your redirect strategy, > there is no protection against the user navigating back and > resubmitting a form, isn't that right? > > Joe
Oops, I missed that. Too much fighting for today :) Actually, I have a solution that I use, which does not allows explicit resubmits too, but it involves quite a few changes to Model/View part, which he most likely will not want to implement. On the other hand, he did not clarify, that user resubmitted the form explicitly. What might have happened, is that the form itself was a result of POST, so when he goes back, the form is reloaded, hence the dialog. The user saw a warning dialog, which, if I remember correctly, does not appear if the form is resubmitted explicitly. So, most likely he clicked the Forward button after clicking Back button. This is the same as Reload, if page is marked as non-cachable. In this case redirect would help. Michael. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]