struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jogep <jo...@web.de>
Subject Re: Result Annotations and parameters
Date Thu, 03 Jan 2008 12:40:22 GMT

I try both, but it has no affect.
Now i try it with an current 2.1.1 Snapshot, but the error still exists.

@Result(value = "result.action", type = ServletActionRedirectResult.class,
params={"bid","${bid}"})


DEBUG (org.apache.struts2.interceptor.FileUploadInterceptor:58) -
√úberspringe //save
java.lang.NumberFormatException: For input string: ""
	at
java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
	at java.lang.Long.parseLong(Long.java:424)
	at java.lang.Long.parseLong(Long.java:461)
	at
com.opensymphony.xwork2.conversion.impl.DefaultTypeConverter.longValue(DefaultTypeConverter.java:209)
	at
com.opensymphony.xwork2.conversion.impl.DefaultTypeConverter.convertValue(DefaultTypeConverter.java:122)
	at
com.opensymphony.xwork2.conversion.impl.DefaultTypeConverter.convertValue(DefaultTypeConverter.java:72)
	at
com.opensymphony.xwork2.conversion.impl.XWorkBasicConverter.doConvertToNumber(XWorkBasicConverter.java:396)
	at
com.opensymphony.xwork2.conversion.impl.XWorkBasicConverter.doConvertToNumber(XWorkBasicConverter.java:421)
	at
com.opensymphony.xwork2.conversion.impl.XWorkBasicConverter.convertValue(XWorkBasicConverter.java:132)
	at
com.opensymphony.xwork2.conversion.impl.XWorkConverter.convertValue(XWorkConverter.java:311)
	at
com.opensymphony.xwork2.ognl.OgnlTypeConverterWrapper.convertValue(OgnlTypeConverterWrapper.java:28)
	at ognl.OgnlRuntime.getConvertedType(OgnlRuntime.java:687)
	at ognl.OgnlRuntime.getConvertedTypes(OgnlRuntime.java:703)
	at ognl.OgnlRuntime.getConvertedMethodAndArgs(OgnlRuntime.java:726)
	at ognl.OgnlRuntime.getAppropriateMethod(OgnlRuntime.java:783)
	at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:794)
	at ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:964)
	at
ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.java:75)
	at ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:131)
	at
com.opensymphony.xwork2.ognl.accessor.ObjectAccessor.setProperty(ObjectAccessor.java:27)
	at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1656)
	at
com.opensymphony.xwork2.ognl.accessor.CompoundRootAccessor.setProperty(CompoundRootAccessor.java:59)
	at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1656)
	at ognl.ASTProperty.setValueBody(ASTProperty.java:101)
	at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
	at ognl.SimpleNode.setValue(SimpleNode.java:246)
	at ognl.Ognl.setValue(Ognl.java:476)
	
and some more	

DEBUG
(org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor:58)
- Validating //save with method execute.
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 'bid' 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)
Caused by: ognl.NoSuchPropertyException:
org.apache.struts2.dispatcher.ServletActionRedirectResult.bid
	at ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:132)
	at
com.opensymphony.xwork2.ognl.accessor.ObjectAccessor.setProperty(ObjectAccessor.java:27)
	at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1656)
	at ognl.ASTProperty.setValueBody(ASTProperty.java:101)
	at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
	at ognl.SimpleNode.setValue(SimpleNode.java:246)
	at ognl.Ognl.setValue(Ognl.java:476)
	at com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:197)
	at
com.opensymphony.xwork2.ognl.OgnlUtil.internalSetProperty(OgnlUtil.java:393)
	... 123 more



Ted Husted wrote:
> 
> 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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Result-Annotations-and-parameters-tp14189762p14596236.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