struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dirk Forchel <dirk.forc...@exedio.com>
Subject Re: redirect
Date Tue, 09 Dec 2008 07:26:46 GMT


Aditya Lukman wrote:
> 
> Hi all,,
> i want to redirect from http://localhost:8080/cimeng/adhit *to*
> http://localhost:8080/cimeng/profile.action?nickname=aray
> 
> so,, how to solve my problem
> 
> please, give me a descriptions for my problem
> thank's for your help
> 

Seems to be quite simple. In your struts.xml add the following (replace the
brackets):

[action name="adhit" class="com.foo.AdhitAction"]
   [result type="redirectAction"]
      [param name="actionName"]profile[/param]
      [param name="param1"]nickname[/param]
      [param name="param2"]${name}[/param]
   [/result]
[/action]

[action name="profile" class="com.foo.ProfileAction"]
   [result]jsp/profile.jsp[/result]
[/action]

Be aware of the difference of the result types in Struts 2.0.x
("redirect-action") and Struts 2.1 ("redirectAction"). In your AdhitAction
class you need a getter-method for the "name" property and in your
ProfileAction class a setter-method for your "nickname" property.
That's all. With OGNL the parameter name is dynamically added to the
redirect URL.


-- 
View this message in context: http://www.nabble.com/redirect-tp20907667p20909952.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Mime
View raw message