struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Jouravlev <jmi...@gmail.com>
Subject Re: Posting from 1JSP to 2Actions and 2Forms
Date Wed, 16 Nov 2005 07:44:57 GMT
If I remember correctly, when you either forward or redirect from one
action to another, Struts performs the reset/populate/validate
sequence again. If you redirect, the request is empty, so nothing to
populate and the form corresponding to second action is not updated.
But if you forward from one action to another, the request object
still retains the input data, and is applied to the second form. If
your second form has setters and they are compatible name-wize with
input parameters, they will be set.

On the other hand, what you want to do is a clear example of action
chaining which is frowned upon ;-)

Michael.

On 11/14/05, Oleg <olegtim@gmail.com> wrote:
> Hi,
>
> I found a long thread talking about one jsp, two action, two action
> forms. However my situation is a bit different and suggested solutions
> would not work, plus I didn't want resurrect an old thread :)
>
> I have:
>
> Jsp A -> Action A (ActionForm A)
>
> Now there are occasions when I need another action, Action B executed
> before Action A but I can only use one jsp page. So what I would have
> is:
>
> Jsp AB - Action B(ActionForm B) ->Action A(ActionForm A)
>
> Where Jsp AB has information to populate both ActionForms A and B.
> Both ActionForms are session scope.
>
> Option 1. Would be to manually populate  ActionForm A in Action B, but
> I would like to avoid that since there will be other possible Actions
> similar to Action B(ActionForm B), so Action C, Action D all ending up
> calling Action A(ActionForm A) and I don't want to change all of them
> every time ActionForm A changes.
>
> Option 2. What if I ActionForm B extends ActionForm A and than it
> becomes something like:
> Jsp AB - Action B(ActionForm B) ->Action A { ...ActionForm A =
> (ActionForm A)ActionForm B..}
>
> This could work but than I am out of luck when I need to use a
> DynaValidatorForm as ActionForm C in  Action C(ActionForm C) - >
> Action A(ActionForm A)
>
> What do you think guys? Whats the best way to go about it.
>
> Thanks,
> Oleg
>
> ---------------------------------------------------------------------
> 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


Mime
View raw message