struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: [s2] Dynamically Parameterize Redirect Result
Date Fri, 10 Nov 2006 23:49:55 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Mark,

Mark Menard wrote:
> Is there a way to dynamically parameterize a redirect result based on an
> http request parameter that you have used in the action your are redirecting
> from?

This isn't exactly struts-2 specific, if I'm reading this correctly.

> Is there a way to get a parameter that was passed to createPartyRoleType
> into the redirect on success?

One way to do it is like this, at the end of your action:

 ActionForward next = mapping.findForward("redirect-action");
 return new ActionForward(next.getPath() + "?id=" + id,
                          next.getRedirect());

There is also ActionRedirect, which essentially wraps an existing
ActionForward:

  ActionRedirect next = new ActionRedirect(mapping.findForward("..."));
  next.addParameter("id", id);

  return next;

I personally think that ActionRedirect isn't good enough, and needs a
lot of improvement. I write my own class and submitted it as an
attachment to https://issues.apache.org/struts/browse/STR-2538, but
nobody seemed interested. Everyone is free to use this class if they'd like.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFVRAj9CaO5/Lv0PARArG7AKCMT5MGdFgUqR6WUWD2ptIxTI5odgCeJl5d
VfPtoSuUAzK49IUsAbF4F5k=
=Xoua
-----END PGP SIGNATURE-----

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


Mime
View raw message