You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by bort <sp...@rogers.com> on 2003/11/24 15:49:30 UTC

ActionForm field not changing when forwarded to Action

Hi all

I have an application which exhibits two similar, yet distinct, behaviours.

Behaviour 1:

Submit Form F to Action A.  In Action A change 1 (or more) of the fields in
Form F.  Forward to JSP J.

Behaviour 2:

Submit Form F to Action A.  In Action A change 1 (or more) of the fields in
Form F.  Forward to Action B.  Action B then forwards to JSP J.

The two behaviours are the same with the exception of the final forwards.
The problem is that while the field value that's changed during Behaviour 1
remains changed when JSP J is presented, the field value does not change
during Behaviour 2.

Does anyone know why?
TIA
bort




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


Re: ActionForm field not changing when forwarded to Action

Posted by bort <sp...@rogers.com>.
Thank you for your response Manish.

"Manish Singla" <Ma...@Sun.COM> wrote in message
news:3FC245AA.6080408@Sun.COM...
> Because when you forward to Action B, at that time Struts Request
> Processor again processes Action Form. (FYI: In Action B, request is
> still having old values from Form F. Thus, values are reset and populated)
>
> HTH
> Manish Singla
>
> bort wrote:
> > Hi all
> >
> > I have an application which exhibits two similar, yet distinct,
behaviours.
> >
> > Behaviour 1:
> >
> > Submit Form F to Action A.  In Action A change 1 (or more) of the fields
in
> > Form F.  Forward to JSP J.
> >
> > Behaviour 2:
> >
> > Submit Form F to Action A.  In Action A change 1 (or more) of the fields
in
> > Form F.  Forward to Action B.  Action B then forwards to JSP J.
> >
> > The two behaviours are the same with the exception of the final
forwards.
> > The problem is that while the field value that's changed during
Behaviour 1
> > remains changed when JSP J is presented, the field value does not change
> > during Behaviour 2.
> >
> > Does anyone know why?
> > TIA
> > bort
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
>
>
> -- 
> Thanks
> Manish Singla
> x73166




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


Re: ActionForm field not changing when forwarded to Action

Posted by Manish Singla <Ma...@Sun.COM>.
You may not specify ActionForm in Action B. Thus struts request 
Processor will not reset values in Acion B.

This implies you have to create an instance of CommonActionForm in 
Action B. (See in which scope you are storing CommonActionForm in Action A).

Alterbate

You may also specify "attribute" in ActionMapping (for Action A) which 
will store bean in request/session scope. After that you have to  create 
instance in Action B

HTH
Manish Singla





Eric Saya wrote:
> Thanks for this answer Manish,
> 
> what would you do if you need to change the value of one form parameter in
> action A and you want to avoid this value to be lost after the forward to
> action B ?
> Is it possible to duplicate the actionform object in a "copy object" that
> the Struts Request Processor wil not overwrite in Action B ?
> 
> BR
> Eric
> 
> ----- Original Message ----- 
> From: "Manish Singla" <Ma...@Sun.COM>
> To: "Struts Users Mailing List" <st...@jakarta.apache.org>
> Sent: Monday, November 24, 2003 6:53 PM
> Subject: Re: ActionForm field not changing when forwarded to Action
> 
> 
> 
>>Because when you forward to Action B, at that time Struts Request
>>Processor again processes Action Form. (FYI: In Action B, request is
>>still having old values from Form F. Thus, values are reset and populated)
>>
>>HTH
>>Manish Singla
>>
>>bort wrote:
>>
>>>Hi all
>>>
>>>I have an application which exhibits two similar, yet distinct,
>>
> behaviours.
> 
>>>Behaviour 1:
>>>
>>>Submit Form F to Action A.  In Action A change 1 (or more) of the fields
>>
> in
> 
>>>Form F.  Forward to JSP J.
>>>
>>>Behaviour 2:
>>>
>>>Submit Form F to Action A.  In Action A change 1 (or more) of the fields
>>
> in
> 
>>>Form F.  Forward to Action B.  Action B then forwards to JSP J.
>>>
>>>The two behaviours are the same with the exception of the final
>>
> forwards.
> 
>>>The problem is that while the field value that's changed during
>>
> Behaviour 1
> 
>>>remains changed when JSP J is presented, the field value does not change
>>>during Behaviour 2.
>>>
>>>Does anyone know why?
>>>TIA
>>>bort
>>>
>>>
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>>
>>
>>
>>-- 
>>Thanks
>>Manish Singla
>>x73166
>>
>>
>>---------------------------------------------------------------------
>>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
> 


-- 
Thanks
Manish Singla
x73166


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


Re: ActionForm field not changing when forwarded to Action

Posted by Eric Saya <er...@cgey.com>.
Thanks for this answer Manish,

what would you do if you need to change the value of one form parameter in
action A and you want to avoid this value to be lost after the forward to
action B ?
Is it possible to duplicate the actionform object in a "copy object" that
the Struts Request Processor wil not overwrite in Action B ?

BR
Eric

----- Original Message ----- 
From: "Manish Singla" <Ma...@Sun.COM>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Monday, November 24, 2003 6:53 PM
Subject: Re: ActionForm field not changing when forwarded to Action


> Because when you forward to Action B, at that time Struts Request
> Processor again processes Action Form. (FYI: In Action B, request is
> still having old values from Form F. Thus, values are reset and populated)
>
> HTH
> Manish Singla
>
> bort wrote:
> > Hi all
> >
> > I have an application which exhibits two similar, yet distinct,
behaviours.
> >
> > Behaviour 1:
> >
> > Submit Form F to Action A.  In Action A change 1 (or more) of the fields
in
> > Form F.  Forward to JSP J.
> >
> > Behaviour 2:
> >
> > Submit Form F to Action A.  In Action A change 1 (or more) of the fields
in
> > Form F.  Forward to Action B.  Action B then forwards to JSP J.
> >
> > The two behaviours are the same with the exception of the final
forwards.
> > The problem is that while the field value that's changed during
Behaviour 1
> > remains changed when JSP J is presented, the field value does not change
> > during Behaviour 2.
> >
> > Does anyone know why?
> > TIA
> > bort
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
>
>
> -- 
> Thanks
> Manish Singla
> x73166
>
>
> ---------------------------------------------------------------------
> 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


Re: ActionForm field not changing when forwarded to Action

Posted by Manish Singla <Ma...@Sun.COM>.
Because when you forward to Action B, at that time Struts Request 
Processor again processes Action Form. (FYI: In Action B, request is 
still having old values from Form F. Thus, values are reset and populated)

HTH
Manish Singla

bort wrote:
> Hi all
> 
> I have an application which exhibits two similar, yet distinct, behaviours.
> 
> Behaviour 1:
> 
> Submit Form F to Action A.  In Action A change 1 (or more) of the fields in
> Form F.  Forward to JSP J.
> 
> Behaviour 2:
> 
> Submit Form F to Action A.  In Action A change 1 (or more) of the fields in
> Form F.  Forward to Action B.  Action B then forwards to JSP J.
> 
> The two behaviours are the same with the exception of the final forwards.
> The problem is that while the field value that's changed during Behaviour 1
> remains changed when JSP J is presented, the field value does not change
> during Behaviour 2.
> 
> Does anyone know why?
> TIA
> bort
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 


-- 
Thanks
Manish Singla
x73166


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