Brian Moseley wrote:
because the form fails validation, the RequestProcessor immediately forwards to the form's input page instead of handing off to the action associated with the form. so no, i can't do it in that action.Ok, thanks for the details. It makes sense now.
there is a "prepare" action for the input page as well:
flow a: EditFormPrepareAction ---> Edit.jsp
flow b: Edit.jsp ---> EditForm ---> EditAction
during flow b, if EditForm fails to validate, the request is forwarded back to flow a.
So, how about changing EditFormPrepareAction to first look for the object id on the form bean that is being passed in, otherwise pull it from the request? Then you'd be able to come in with ?id=<whatever> or through a forwarded validation error.
Oh, but I see you've tried that...
i expected that, after EditForm fails to validate, the form object passed into EditFormPrepareAction would be the same instance of EditForm that failed validation (where the required bit of data is available as an attribute).Yes, it should be. Do you have the form name listed on that action? Let's see your action mappings for the prepare and edit actions.
in fact, the form object that's passed into the prepare action is null. i don't know why.The form bean itself is null... hmmm??? strange - only if you've not specified it on the action mapping is my guess.
Oh, there are always around things! :) Putting things in request or session scope work, depending on whether you are doing a redirect. Or the evil action chaining keeping things available for you in a later action. And I'm sure some other tricks too.Sometimes we "hack" a request parameter in to the forward from the action by creating a new ActionForward based on the path of an existing one...
return new ActionForward(mapping.findForward("success").getPath() + "?id=" + id);
(hopefully no typos there, but you get the idea). No need to do session scope stuff to make this happen.
yep, when i need to change a forward path inside an action, i do almost exactly this. it may be a hack, but i don't see any way around it.
i apologize for being imprecise in the original post. the prepare action is the component that requires the request parameter. it then sets a request attribute, which is used by the jsp. so i'm already following that bit of advice :)I'd modify the code so that a request parameter is optional if it can be gotten another way.
Erik
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
