http://jaxmag.com/itr/online_artikel/psecom,id,648,nodeid,147.html

More in saveToken();

 Chandra

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 02, 2006 2:32 PM
To: user@struts.apache.org
Subject: RE: Example needed for saveToken

Some useful code:

The action code may look like this.

// Check for a valid token
if(isTokenValid(request)){
// If the token is valid, reset it and perform the business logic
        resetToken(request);
        insertRecord(request);//Business logic call.
        return mapping.findForward(Globals.FORWARD_SUCCESS);
}
else{
        // If not valid, save a new token and forward appropriately
        saveToken(request);
        return mapping.findForward(Globals.FORWARD_INSERT);
}

If the Token is not found in the request, the request will go through
the else block, a Token will be saved, and the user will be directed to
the appropriate page for inputting new data . Assuming a Struts
<html:form> tag is used on that page, the Token will be added
appropriately to the request. When the form is submitted, the request
goes through the if block. By resetting the Token here, we ensure that
if the user clicks back and tries to resubmit the form, the <record>
will not be re-created. 


Chandra

-----Original Message-----
From: starki78 [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 02, 2006 2:24 PM
To: user
Subject: Example needed for saveToken

Ciao!

I need some mechanism for preventing a user of starting several long
database queries by clicking a submit button.
Therefor I' would like to use the save token of struts.
If the token is not valid the user should get a message and be
redirected to the inputPage.

Where do I have to use saveToken?

Can someone give me an example that works properly?

Thanks!
Starki








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

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to