I am using saveToken, isTokenValid, etc., to ensure that a registration/update form is not stale. I invoke this method from execute in the setup Action, just before forwarding to the form page.

When the form is submitted, there are two levels of validation before the form data is processed.

First, input validation happens. I use ValidatorForm with the Validator plugin. If there is an input validation error, Struts forwards back to the input page, and the original synchronizer token is still in place as a hidden variable in the form.

Second, if input validation succeeds, there is validation at the manager layer. For example, a username might already be taken. If there is a manager validation error, Struts forwards back to the input page, but this time, the synchronizer token is not in place -- the hidden field in the form is gone.

The result of this is that if you request an add/edit form, fill it out, submit it and cause a manager validation error, you cannot simply edit the offending field and resubmit the form -- you need a fresh form. This is not the desired behavior, as this type of validation error should be treated the same as a form validation error, with regard to the synchronizer token.

I am using Struts declarative exception handling, which handles the forwarding.

How can I make sure the hidden field is rendered in the form after the second type of error occurs and Struts forwards back to the input screen? Why is it gone in the first place? I thought of RequestProcessor.processException, but couldn't see a way to invoke resetToken or saveToken. Should I do something with my form bean reset method?

Erik



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



Reply via email to