but I wonder if that's a good idea.
Am I missing something here? Is there a way to ensure that the action is called each time with the set of parameters it was supposed to receive?

If your forms are request scoped, there should be no problem; a new object would be created each time.

If you must use session scoped forms, it's not so easy, as the "token" mechanism for dealing with "double-posts" is not automatic; you must invoke it from your action, which means that the population/corruption may have already happened.

If you are actually using JavaScript to submit these forms, then I'd suggest adding some JavaScript which sets a "submitted" flag and tests it before actually causing a submit, setting it to true after it does submit. I think that in a single page (not frame), things should be single-threaded so that this is relatively safe.

The other solution would be to extend the RequestProcessor to add a token validation step earlier than in the Action's execute() method. Actually, in Struts 1.3 this would be easier for all the reasons that Struts 1.3 makes changing the request processing path easier. You could make a "validate token" command which would check the ActionMapping to see if it had been configured to "require valid token" (probably using Struts 1.3's "arbitrary config properties") and if that configuration had been set, you'd do the validation (which can be done using ActionContext), and if the validation failed, you'd probably fall back to using some other configuration property of the ActionMapping to determine the fallback action.

It actually seems like something which would be useful to add to the Struts 1.3 core, and perhaps even into the default chain. Unfortunately, I don't have time to code up something like that this month, but if you're interested, I can at least try to field basic questions here on the list (and hopefully so can others!)

The use of tokens in Struts 1.3 is probably something which could use a bit of a workout anyway; I can't remember why offhand, but I had some questions about how I adapted the processing model from Action to ActionContext and I haven't had an opportunity to really give that a workout myself.

Joe

--
Joe Germuska
[EMAIL PROTECTED] * http://blog.germuska.com
"You really can't burn anything out by trying something new, and
even if you can burn it out, it can be fixed.  Try something new."
        -- Robert Moog

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

Reply via email to