You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Nelson, Laird" <La...@FMR.COM> on 2003/04/30 20:46:51 UTC

Basic struts tag question related to formbeans

This is such a basic question I'm embarrassed to ask it, but I really
couldn't figure out the answer from the user guides.  Oh well; here goes.
 
I've got an Action that displays a form:

Action1 --> form.jsp

That form submits to another Action that processes it:

form.jsp --> Action2

So in my struts-config.xml I've got a form bean set up on Action2 with
request scope:

<action path="/action2" name="someFormBean" scope="request"
input="/action1"...>

The intent, as I understand it, is to provide a bean that represents the
form on form.jsp to the Action (Action2) that's processing it.  No problems
so far.
 
Now when my form bean performs validation, and when validation fails, the
form bean creates an ActionErrors and returns it.  Struts obligingly
consults the "input" attribute to figure out where to forward control.  My
intent is that control be forwarded right back to Action1, so that form.jsp
will show up again, but this time with:

*	the form fields populated with the user's just-entered input values
*	various html errors output

What happens is that form.jsp shows up with the html errors output, but the
values in the form fields aren't prefilled.
 
Do I need to declare the same formbean on both Action2 and Action1?
 
Humbly,
Laird

--
Laird J. Nelson
Electronic Channel Group, Fidelity eBusiness (Veritude)
* (508) 357-3142
* laird.nelson@fmr.com <ma...@fmr.com> 
* 1075462@skytel.com <ma...@skytel.com> 

 

Re: Basic struts tag question related to formbeans

Posted by "K.C. Baltz" <kc...@lollimail.com>.
>
> My intent is that control be forwarded right back to Action1, so that 
> form.jsp will show up again, but this time with:
>
I think forwarding one action to another is called "Action Chaining" and 
I believe it's discouraged.  Why not set your input="form.jsp"? 

K.C


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


Re: Basic struts tag question related to formbeans

Posted by James Mitchell <jm...@apache.org>.
This exact scenario is demonstrated in the struts-example.  Have you looked
that yet?

--
James Mitchell
Software Developer/Struts Evangelist
http://www.open-tools.org



----- Original Message -----
From: "Nelson, Laird" <La...@FMR.COM>
To: <st...@jakarta.apache.org>
Sent: Wednesday, April 30, 2003 2:46 PM
Subject: Basic struts tag question related to formbeans


> This is such a basic question I'm embarrassed to ask it, but I really
> couldn't figure out the answer from the user guides.  Oh well; here goes.
>
> I've got an Action that displays a form:
>
> Action1 --> form.jsp
>
> That form submits to another Action that processes it:
>
> form.jsp --> Action2
>
> So in my struts-config.xml I've got a form bean set up on Action2 with
> request scope:
>
> <action path="/action2" name="someFormBean" scope="request"
> input="/action1"...>
>
> The intent, as I understand it, is to provide a bean that represents the
> form on form.jsp to the Action (Action2) that's processing it.  No
problems
> so far.
>
> Now when my form bean performs validation, and when validation fails, the
> form bean creates an ActionErrors and returns it.  Struts obligingly
> consults the "input" attribute to figure out where to forward control.  My
> intent is that control be forwarded right back to Action1, so that
form.jsp
> will show up again, but this time with:
>
> * the form fields populated with the user's just-entered input values
> * various html errors output
>
> What happens is that form.jsp shows up with the html errors output, but
the
> values in the form fields aren't prefilled.
>
> Do I need to declare the same formbean on both Action2 and Action1?
>
> Humbly,
> Laird
>
> --
> Laird J. Nelson
> Electronic Channel Group, Fidelity eBusiness (Veritude)
> * (508) 357-3142
> * laird.nelson@fmr.com <ma...@fmr.com>
> * 1075462@skytel.com <ma...@skytel.com>
>
>
>


----------------------------------------------------------------------------
----


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


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