struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ted Husted" <hus...@apache.org>
Subject Re: S2/SmartURLs: parameterized results...
Date Wed, 21 Nov 2007 18:27:27 GMT
Leave out the get :)

 @Result(name="success",location="/competitions/admin?id=${compId}",

should work just fine, if compId is an Action class property, or
otherwise on the value stack.

-Ted.

On Nov 18, 2007 12:20 AM, Eric D Nielsen <nielsene@mit.edu> wrote:
> I've been trying to understand how parameterized results should work under the
> SmartURLs plugin for Struts 2.  In my specific case, I'm trying to redirect on
> success to a new URL that includes a paramter.  I've tried modelling it after
> the standard XML=based example in the WebWork in Action book on page 191:
>
>   <result name="success"
> type="redirect">order-confirmation.jsp?confirmationNumber=${confirmationNumber}</result>
>
> So I tried
> @Results({
>   @Result(name="success",location="/competitions/admin?id=${getCompId}",
> type="redirect")})
>
> However nothing gets injected into the variable.  I've tried several different
> formulations of the variable: getCompId, getCompId(), compId, etc.   Currently
> I have a simple method on the action:
>   public String getCompId() {return (comp!=null ? comp.getId().toString() :
> "0";}
>
> (In reality "0" should never be returned, but I wanted an explicit value to be
> able to tell if I've hooked up the paramter correctly, versus having access to
> the Id in the first place.)
>
> When I try to follow along directly with the XML based approach the
> action/results from struts.xml seem to interact poorly with the other
> annotation based configurations and I can't seem to chase down what would make
> a valid hybrid configuration.
>
> Cna anyone give me some pointers on how to either make paramterized locations
> work with SmartURLs or, how to configure these results in struts.xml wtthout
> interfereing too much with the other convention/annotations based approaches?
>
> Thank you.
>
> Eric

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


Mime
View raw message