struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ted Husted" <hus...@apache.org>
Subject Re: Result Annotations and parameters
Date Sun, 09 Dec 2007 15:20:24 GMT
Is the property actually "ID", as in "String getID()" ?

Or is it getId() ?

In the JPA MailReader code (see the sandbox), @Results like this one
are working:

@Result(name = Index.SUCCESS, value = Index.INDEX, type
=ServletActionRedirectResult.class, params = {Index.USER,
Index.USER_USERNAME })

where

    public static final String USER = "user";
    public static final String USER_USERNAME = "${user.username}";

The end result is the that user parameter is appended to the query
string for the redirect.

-- HTH, Ted
 * <http://www.StrutsMentor.com/>

On Dec 9, 2007 5:32 AM, Johannes Geppert <jogep@web.de> wrote:
> Does no one have a resolution for my problem?
> With XML-Configuration it works perfectly.
> But I like the Configuration with Annotations.
>
> I try it with Struts 2.1.0 and the codebehind plugin.
>
> Thank You
> Johannes
>
>
> >
> > Hello,
> >
> > i try to use the Result Annotations  in my new Project, this works fine for me.
> > But when I try to use parameters I become an Exception.
> >
> > Config:
> > @Namespace(value="/")
> > @Results( {
> >     @Result(value = "myresult.action", type = ServletActionRedirectResult.class,
params={"ID","${ID}"}),
> >     @Result(value = "/pages/search.jsp", name="input")
> >         })
> > public class Search extends BaseSupport
> >
> >
> > In the log I found following messages:
> > DEBUG (org.apache.struts2.config.ClasspathPackageProvider:58) - ClasspathPackageProvider:
Processing class de.geppert.actions.Search
> > DEBUG (org.apache.struts2.config.ClasspathPackageProvider:58) - Adding parmeter[ID:${ID}]
to result.
> >
> > this looks fine but I when I use this Action It returned a NullPointerException
and following log messages:
> >
> > ERROR (com.opensymphony.xwork2.DefaultActionInvocation:28) - There was an exception
while instantiating the result of type org.apache.struts2.dispatcher.ServletActionRedirectResult
> > Caught OgnlException while setting property 'ID' on type 'org.apache.struts2.dispatcher.ServletActionRedirectResult'.
- Class: ognl.ObjectPropertyAccessor
> > File: ObjectPropertyAccessor.java
> > Method: setProperty
> > Line: 132 - ognl/ObjectPropertyAccessor.java:132:-1
> >       at com.opensymphony.xwork2.ognl.OgnlUtil.internalSetProperty(OgnlUtil.java:400)
> >       at com.opensymphony.xwork2.ognl.OgnlUtil.setProperties(OgnlUtil.java:87)
> >       at com.opensymphony.xwork2.ognl.OgnlReflectionProvider.setProperties(OgnlReflectionProvider.java:55)
> >       at com.opensymphony.xwork2.ObjectFactory.buildResult(ObjectFactory.java:222)
> >       at com.opensymphony.xwork2.DefaultActionInvocation.createResult(DefaultActionInvocation.java:201)
> >       at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:349)
> >       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:259)
> >       at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:141)
> >       at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:85)
> >       at com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:230)
> >       at com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:229)
> >       at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
> >       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:227)
> >       at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:248)
> >       at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:48)
> >       at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:85)
> >       at com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:230)
> >       at com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:229)
> >       at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
> >       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:227)
> >       at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:124)
> >       at com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:230)
> >       at com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:229)
> >       at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
> >       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:227)
> >       at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:170)
> >       at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:85)
> >       at com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:230)
> >       at com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:229)
> >       at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
> >       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:227)
> >       at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:104)
> >       at com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:230)
> >       at com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:229)
> >       at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
> >
> > Can anybody resolve my problem?  I think my configuration has no errors, because
my Actions without parameters work fine.
> >
> > Best Regards
> > Johannes Geppert

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


Mime
View raw message