struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raj Nagappan <...@velocitylabs.com>
Subject Re: Setting object from param tag fails in Struts 2.2.1
Date Wed, 17 Nov 2010 09:45:18 GMT
I did some experimenting with this by removing the lazy load and putting 
the actual object directly on a property in the action class. This had 
no effect.

So then I created a catch-all method setKeywordList(Object obj) to see 
what was being passed in. The actual data being passed in is a single 
element String array. The only element in the array is a string 
"KeywordList@1f75664" ie. the Struts param tag is calling toString() on 
the object and passing the resulting string inside an array to the 
action class.

I would say this is a regression bug from 2.0.x, yes?

Raj.


On 16/11/2010 9:18 PM, Raj Nagappan wrote:
> Hi,
>
> The parameter is definitely an object, if I replace the JSP below with
>
> <h1><s:property value="photoSet.keywordListLazyLoad"/></h1>
> <h1><s:property value="photoSet.keywordListLazyLoad.id"/></h1>
>
> I get KeywordList@3bcdf1, 15
>
> which is correct. Furthermore if I add a setKeywordList(String[] 
> param) method or setKeywordList(String param) method into the action 
> class, it never invokes those new methods but still throws exactly the 
> same exception.
>
> The only other thing I can think of is that it's trying to set the 
> cglib proxy object on the action class and is complaining about that. 
> We are using cglib-nodep-2.2 to lazy load the KeywordList, and it 
> worked perfectly fine in Struts 2.0.
>
> (Sorry if this appears multiple times, I keep getting a spam rejection 
> notice.)
>
> Raj.
>
> On 6:59 AM, Li Ying wrote:
>> "[Ljava.lang.String;" means a String array.
>>
>> Looks like you are trying to copy a List from one action to another.
>>
>> By somehow, struts2 is looking for a set method which take a String
>> array as it's parameter.
>>
>>
>>
>> 2010/11/15 Raj Nagappan<raj@velocitylabs.com>:
>>> Hi, we recently upgraded from Struts 2.0.14 to 2.2.1 and I notice that
>>>
>>> the following JSP code to inject an object property from one action 
>>> into
>>> another action has stopped working:
>>>
>>> <s:if test=hotoSet.keywordListLazyLoad != null">
>>> <s:action namespace=search" name="KeywordList" executeResult="true"
>>> ignoreContextParams=rue">
>>> <s:param name=eywordList" value="photoSet.keywordListLazyLoad"/>
>>> </s:action>
>>> </s:if>
>>>
>>> So it checks that the object is not null and then tries to set it on 
>>> the
>>> parameter "keywordList". This worked perfectly fine in 2.0.x, but in 
>>> 2.2
>>> on the server side we get:
>>>
>>> java.lang.NoSuchMethodException:
>>> KeywordListAction.setKeywordList([Ljava.lang.String;)
>>> Â  Â at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1226)
>>> Â  Â at ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:1474)
>>> Â  Â at
>>> ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.java:85)

>>>
>>> Â  Â at
>>> ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:162) 
>>>
>>>
>>> And the resulting error displayed on the web page is:
>>>
>>> Exception name: No result defined for action KeywordListAction and
>>> result input
>>> No result defined for action KeywordListAction and result input at
>>> com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:375)

>>>
>>> at
>>> com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:277)

>>>
>>> at
>>> com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263)

>>>
>>> at
>>> org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept

>>>
>>> (AnnotationValidationInterceptor.java:68) at
>>> com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept
>>>
>>> Is this a bug or do I need to do something differently for 2.2?
>>>
>>> Raj.
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail:user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail:user-help@struts.apache.org
>>>
>>>


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


Mime
View raw message