struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Jouravlev" <jmi...@gmail.com>
Subject Re: (Rename) How Do I Forward Request Parameters in Struts?
Date Tue, 05 Sep 2006 20:14:34 GMT
On 9/5/06, Help My PC! <hlpmypc@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


Mime
View raw message