>  I need to tag along a request paramter. So my annotation looks
>  like this:
>
>  @Result(name="enterNewContactInfo",value="enterNewContactInfo",
>  type=ServletActionRedirectResult.class,params={"country","AUT"})
>
>  I get a nasty NPE if I add the params. If I remove it everything
works fine.

It's a known issue which has been fixed in Struts 2.1:
https://issues.apache.org/struts/browse/WW-2170
As you mentioned, putting the results in struts.xml will fix it, or as a
workaround you can use
@Result(type=ServletRedirectResult.class,
value="/actionName.action?param1=value1")

> Another question is how do I set the parameter dynamically ? If I  
> recall correctly WW had a special syntax for it. Something like  
> params={"country","%{country}"}, but with no annotations for  
> course.Any way to do this in S2?

This can be done in xml or with annotations. For ServletRedirectResult,
using the above example:

@Result(type=ServletRedirectResult.class,
value="/actionName.action?param1=${value1}")

will evaluate 'value1' as an OGNL expression

and for ServletActionRedirectResult (once Struts 2.1 gets released or
WW-2170 is backported to 2.0.x), I believe the following would work.

@Result(type= ServletActionRedirectResult.class, value="actionName",
params={"param1","${value1}"})

The big advantage of ServletActionRedirectResult over
ServletRedirectResult is that it automatically URL-encodes the
parameters.

> I am having way too many problems with this zero config/codebehind.
> Technically the codebehind plugin is listed as 'experimental' on the
wiki.
> The convention plugin (only for Struts 2.1) look incredible.

Having said all of that, I've been able to get the zero
config/codebehind working and (in Spring 2.5) component scanned Spring
beans so that newly written Actions and DAOs require few annotations and
no xml configuration. What other kind of problems have you had?

Brad Cupit
Louisiana State University - UIS


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to