You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by debussy007 <de...@gmail.com> on 2007/10/12 09:45:35 UTC

Repopulate form in execute() method - Struts 1

Hello,

When the user submits my form,
I retrieve it as a DynaActionForm, do some checks in execute() method,
and if the form submitted is not valid,
I want to forward to the form again and repopulate the form with the
inserted values.

How can I achieve this ?
[...]
if( ! valid ) {

   // Instruction to repopulate the form, put the form in request ???

   errors.add( ActionErrors.GLOBAL_ERROR, 
         new ActionError("errorkey", "Invalid data"));
   saveErrors(request, errors);
   return mapping.findForward("error"); // forward to the form
}
[...]

Thank you for any kind help !
-- 
View this message in context: http://www.nabble.com/Repopulate-form-in-execute%28%29-method---Struts-1-tf4611970.html#a13170657
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Repopulate form in execute() method - Struts 1

Posted by debussy007 <de...@gmail.com>.
Thank you d.  :-)


newton.dave wrote:
> 
> If the forward isn't a redirect you shouldn't need to
> repopulate the form. This use-case, btw, is what
> "mapping.getInputForward()" is for (along with the
> "input" attribute of the action configuration
> element).
> 
> d.
> 
> --- debussy007 <de...@gmail.com> wrote:
> 
>> 
>> Hello,
>> 
>> When the user submits my form,
>> I retrieve it as a DynaActionForm, do some checks in
>> execute() method,
>> and if the form submitted is not valid,
>> I want to forward to the form again and repopulate
>> the form with the
>> inserted values.
>> 
>> How can I achieve this ?
>> [...]
>> if( ! valid ) {
>> 
>>    // Instruction to repopulate the form, put the
>> form in request ???
>> 
>>    errors.add( ActionErrors.GLOBAL_ERROR, 
>>          new ActionError("errorkey", "Invalid
>> data"));
>>    saveErrors(request, errors);
>>    return mapping.findForward("error"); // forward
>> to the form
>> }
>> [...]
>> 
>> Thank you for any kind help !
>> -- 
>> View this message in context:
>>
> http://www.nabble.com/Repopulate-form-in-execute%28%29-method---Struts-1-tf4611970.html#a13170657
>> Sent from the Struts - User mailing list archive at
>> Nabble.com.
>> 
>> 
>>
> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> user-unsubscribe@struts.apache.org
>> For additional commands, e-mail:
>> user-help@struts.apache.org
>> 
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Repopulate-form-in-execute%28%29-method---Struts-1-tf4611970.html#a13174204
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Repopulate form in execute() method - Struts 1

Posted by Dave Newton <ne...@yahoo.com>.
If the forward isn't a redirect you shouldn't need to
repopulate the form. This use-case, btw, is what
"mapping.getInputForward()" is for (along with the
"input" attribute of the action configuration
element).

d.

--- debussy007 <de...@gmail.com> wrote:

> 
> Hello,
> 
> When the user submits my form,
> I retrieve it as a DynaActionForm, do some checks in
> execute() method,
> and if the form submitted is not valid,
> I want to forward to the form again and repopulate
> the form with the
> inserted values.
> 
> How can I achieve this ?
> [...]
> if( ! valid ) {
> 
>    // Instruction to repopulate the form, put the
> form in request ???
> 
>    errors.add( ActionErrors.GLOBAL_ERROR, 
>          new ActionError("errorkey", "Invalid
> data"));
>    saveErrors(request, errors);
>    return mapping.findForward("error"); // forward
> to the form
> }
> [...]
> 
> Thank you for any kind help !
> -- 
> View this message in context:
>
http://www.nabble.com/Repopulate-form-in-execute%28%29-method---Struts-1-tf4611970.html#a13170657
> Sent from the Struts - User mailing list archive at
> Nabble.com.
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org