struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Hill" <andrew.david.h...@gridnode.com>
Subject RE: passing parameters or object from one action to other
Date Thu, 05 Jun 2003 11:35:15 GMT
(Oops. Hit send too soon. Try again!)

You can put them in the request as attributes and use a non-redirecting
forward *but* then you are 'action chaining'.

(Action chains are bad. n'kay)

The other alternative - suitable for string parameters - is to make them
request parameters by appending to the url.
To do this you create a new forward based on the existing forward. ie in
your action:

ActionForward forward = mapping.findForward("myforward");
forward = new
ctionForward( addParameterToUrl(forward.getPath(),"foo","bar"),
forward.getRedirect() );
return forward;

where addParameterToUrl does something like:

  private String addParameterToURL(String url, String parameter, String
value)
  {
    return url + ( (url.indexOf("?")==-1) ? "?" : "&" ) + parameter + "=" +
value;
  }

-----Original Message-----
From: meissa.Sakho@assetmanagement.natexis.fr
[mailto:meissa.Sakho@assetmanagement.natexis.fr]
Sent: Thursday, 5 June 2003 19:25
To: struts-user@jakarta.apache.org
Subject: passing parameters or object from one action to other



hi all,

I have an action1 whose forward is another action2.

I need to pass some parameters or object from action1
to action2

I don't want to put them(parameters or object) in the session.

Is there a solution for doing that.

thanks in advance

Meissa

L'integrite de ce message n'etant pas assuree sur internet, Natexis
Banques Populaires ne peut etre tenu responsable de
son contenu. Toute utilisation ou diffusion non autorisee est
interdite. Si vous n'etes pas destinataire de ce message, merci de le
detruire et d'avertir l'expediteur.

The integrity of this message cannot be guaranteed
on the Internet. Natexis Banques Populaires can not therefore be
considered responsible for the contents.Any unauthorized use or
dissemination is prohibited.
If you are not the intended recipient of this message, then please delete it
and
notify the sender.


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


Mime
View raw message