Struts has built in token functionality to prevent the "submit button pressed twice" problem.
In action class add(), edit(), and delete() methods, or any method that is preparing to send user to a form for subsequent submittal, add this: saveToken(request). It's a member of Action. In jsp page(s), add this: <input type="hidden" name="$form.tokenName" value="$form.token"> In action class save() method, add this: if (!isTokenValid(request)) { //add to ActionErrors } -----Original Message----- From: Lim Hock-Chai [mailto:[EMAIL PROTECTED] Sent: Friday, September 23, 2005 1:58 PM To: Struts Users Mailing List Subject: RE: Change the query parm before forward My app uses order item seq# in the query parm to add/update the shopping cart. If there is no order item seq#, I simply do add. However, the problem occur when user uses the browser back button and press submit again, this cause my app to add again. I prefer it to do update. using session/request attribute might not work for me. Not sure. I'm new to web development. -----Original Message----- From: Wendy Smoak [mailto:[EMAIL PROTECTED] Sent: Friday, September 23, 2005 2:39 PM To: Struts Users Mailing List Subject: Re: Change the query parm before forward From: "Lim Hock-Chai" <[EMAIL PROTECTED]> > In my struts config file, I've a initialization action. If say the > order > item > sequence# is missing in the query parm, I need to change it to default to > the next item sequence # before it forward to the actual form. In your initialization Action, set the form bean property for the sequence number to the correct value before you forward to the view. If it's not a form bean property, you can set it as a request or session attribute under a known key. (Otherwise, what are you doing that requires the sequence number to be a request parameter?) -- Wendy Smoak --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] **************************************************************************** This email may contain confidential material. If you were not an intended recipient, Please notify the sender and delete all copies. We may monitor email to and from our network. **************************************************************************** --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]