Let me take that back. The proper idiom is to use the params attribute.
> @Result(name="success",location="/competitions/admin",
> params={"id","${compId}"})
If there is more than one parameter, we can continue to add more
name/value pairs to the array.
-Ted.
On Nov 21, 2007 1:27 PM, Ted Husted <[EMAIL PROTECTED]> wrote:
> 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 <[EMAIL PROTECTED]> 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
>
--
HTH, Ted <http://www.husted.com/ted/blog/>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]