You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Help My PC! <hl...@yahoo.com> on 2006/09/05 21:36:09 UTC

(Rename) How Do I Forward Request Parameters in Struts?

Hi,

In struts, I have an action Act1 that forwards to a display page Page1. 
On that page there is a submit button whose action act2 forwards to 
display page Page2.

I need to modify Page1 in such a way that I add an additional submit 
button whose action Act1A forwards to display page Page1A. On page Page1A 
there is a button whose action is the same as in the previous flow, 
Act2, but the request parameters from Page1 and Page1a I'd like to forward 
to Act 2.

What is the best way to handle this?

My action, Act1a returns null, but when I'm losing the request 
parameters from page 1. How do I forward the request parameters from page 1 
while maintaining the request parameters from page1a to action2?

I hope that this makes sense. Thanks for your assistance.

 		
---------------------------------
Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls.  Great rates starting at 1ยข/min.

Re: (Rename) How Do I Forward Request Parameters in Struts?

Posted by Help My PC! <hl...@yahoo.com>.
Thanks for the help. You've solved my problem.

Michael Jouravlev <jm...@gmail.com> wrote: On 9/5/06, Help My PC!  wrote:
>
> Hi,
>
> In struts, I have an action Act1 that forwards to a display page Page1.
> On that page there is a submit button whose action act2 forwards to
> display page Page2.
>
> I need to modify Page1 in such a way that I add an additional submit
> button whose action Act1A forwards to display page Page1A. On page Page1A
> there is a button whose action is the same as in the previous flow,
> Act2, but the request parameters from Page1 and Page1a I'd like to forward
> to Act 2.
>
> What is the best way to handle this?
>
> My action, Act1a returns null, but when I'm losing the request
> parameters from page 1. How do I forward the request parameters from page 1
> while maintaining the request parameters from page1a to action2?
>
> I hope that this makes sense. Thanks for your assistance.

The following are standard choices:

(1) Use hidden form fields
--------------------------

In Act1A gather parameters from Page1 and stick them into a form on
Page1A as hidden fields. In Act2 read values of these hidden fields
from request. If you want to autopopulate the ActionForm that
corresponds to Act2 with values from Page1, then you need to have the
appropriate setters.

(1) Use session-scoped object (either an ActionForm or your own)
----------------------------------------------------------------

Session-scoped ActionForms are not recreated on each request, so you
can lookup for an ActionForm that corresponds to Act1 in the
HttpSession object to retrieve the values. You will need to dispose of
that ActionForm manually if you want to conserve server's memory.

Michael.

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



 		
---------------------------------
Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls.  Great rates starting at 1&cent;/min.

Re: (Rename) How Do I Forward Request Parameters in Struts?

Posted by Michael Jouravlev <jm...@gmail.com>.
On 9/5/06, Help My PC! <hl...@yahoo.com> wrote:
>
> Hi,
>
> In struts, I have an action Act1 that forwards to a display page Page1.
> On that page there is a submit button whose action act2 forwards to
> display page Page2.
>
> I need to modify Page1 in such a way that I add an additional submit
> button whose action Act1A forwards to display page Page1A. On page Page1A
> there is a button whose action is the same as in the previous flow,
> Act2, but the request parameters from Page1 and Page1a I'd like to forward
> to Act 2.
>
> What is the best way to handle this?
>
> My action, Act1a returns null, but when I'm losing the request
> parameters from page 1. How do I forward the request parameters from page 1
> while maintaining the request parameters from page1a to action2?
>
> I hope that this makes sense. Thanks for your assistance.

The following are standard choices:

(1) Use hidden form fields
--------------------------

In Act1A gather parameters from Page1 and stick them into a form on
Page1A as hidden fields. In Act2 read values of these hidden fields
from request. If you want to autopopulate the ActionForm that
corresponds to Act2 with values from Page1, then you need to have the
appropriate setters.

(1) Use session-scoped object (either an ActionForm or your own)
----------------------------------------------------------------

Session-scoped ActionForms are not recreated on each request, so you
can lookup for an ActionForm that corresponds to Act1 in the
HttpSession object to retrieve the values. You will need to dispose of
that ActionForm manually if you want to conserve server's memory.

Michael.

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