You can use tokens within the Action classes to help prevent multiple
submits.  Take a look at the Action Servlet Java Doc for the following
methods:

isTokenValid( request )
resetToken( request )
saveToken( request )

We are using tokens in our app right now.  We do something like the
following:


If( isTokenValid( request ) ) {
        //Insert to DB
        resetToken( request );
} else {
        //select from DB
}

saveToken( request );

HTH,

Daniel

-----Original Message-----
From: Chris Cheshire [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 27, 2006 10:11 AM
To: Struts Users Mailing List
Subject: forwarding vs redirecting issue

Hi,

I have a design issue based around form submission, protecting against
resubmission etc.

I have seen a couple of design "guidelines" that seem to conflict.

1) Use the session as little as possible (memory issues etc)
2) Use forwards where possible as requests can be passed along, with
original information preserved, as well as speeding up communication.

Now the only problem I face is after an action is complete, if I
forward to a JSP, that action is open to resubmission when the user
starts playing with the reload and back buttons on their browser.
Redirects, because of the URL changing, can help protect against this.

So the solution seems to be to place the beans required by the JSP
page in displaying the result of the action in the session instead. So
now there is an issue of when do the objects for the action that was
just performed get removed from the session?

Do I just put something in the start of each action to remove from the
session all objects not associated with that action?

Thanks

Chris

---------------------------------------------------------------------
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]

Reply via email to