struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject RE: Example needed for saveToken
Date Tue, 02 May 2006 09:01:50 GMT
Some useful code:

The action code may look like this.

// Check for a valid token
// If the token is valid, reset it and perform the business logic
	insertRecord(request);//Business logic call.
	return mapping.findForward(Globals.FORWARD_SUCCESS);
	// If not valid, save a new token and forward appropriately
	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. 


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


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?


To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message