Hi,

I guess it is a common problem of web applications that they need to track
how many times a user clicks a submit button. Assuming, that a click on the
submit button executes an expensive stored procedure on a database server
which may take 10 to 20 seconds, lots of users get impatient and click the
submit button again and again.

I tracked this down and noticed, that every click executes the perform
method of my Action class. In fact the server executes the procedure as many
times as the user clicks the button.

In the struts framework I found in the Action class the following methods:

generateToken(), isTokenValid(), resetToken() and saveToken()

Could anybody explain how and where to use these methods best to prevent an
action from executing multiple times?

I see the following processing inside the action.perform() method:

1) getParameters from the form
2) determine whether the form needs first to be delivered or the user input
needs to be processed
if user input needs to be processed continue with 3) otherwise deliver the
form...
3) validate the parameters
4) process request
5) catch any errors and return them (if there are any)
6) deliver the results by forwarding to a view template

In my opinion the steps 3 to 5 should be treated like a transaction and any
further submits from the same session should not be processed. Could anybody
please post an exemple how to solve that problem best?

Many thanks

Thomas




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

Reply via email to