You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Raj Nagappan <ra...@velocitylabs.com> on 2010/11/15 08:52:12 UTC

Setting object from param tag fails in Struts 2.2.1

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="photoSet.keywordListLazyLoad != null">
<s:action namespace="/search" name="KeywordList" executeResult="true"
ignoreContextParams="true">
<s:param name="keywordList" 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


Re: Setting object from param tag fails in Struts 2.2.1

Posted by Maurizio Cucchiara <ma...@gmail.com>.
What does your collection contain at runtime?

2010/11/15 Raj Nagappan <ra...@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="photoSet.keywordListLazyLoad != null">
> <s:action namespace="/search" name="KeywordList" executeResult="true"
> ignoreContextParams="true">
> <s:param name="keywordList" 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
>
>


-- 
Maurizio Cucchiara

Re: Setting object from param tag fails in Struts 2.2.1

Posted by Li Ying <li...@gmail.com>.
"[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 <ra...@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="photoSet.keywordListLazyLoad != null">
> <s:action namespace="/search" name="KeywordList" executeResult="true"
> ignoreContextParams="true">
> <s:param name="keywordList" 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


Re: Setting object from param tag fails in Struts 2.2.1

Posted by Maurizio Cucchiara <ma...@gmail.com>.
Not much has changed since the 2.2.1 version

2011/1/5 Pro1712 <Pr...@yahoo.de>:
>
> It works with the latest build (#252)!
> Do you see any problems using this version in a production environment?
>
> --
> View this message in context: http://old.nabble.com/Setting-object-from-param-tag-fails-in-Struts-2.2.1-tp30216692p30593987.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
>
>



-- 
Maurizio Cucchiara

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


Re: Setting object from param tag fails in Struts 2.2.1

Posted by Pro1712 <Pr...@yahoo.de>.
It works with the latest build (#252)!
Do you see any problems using this version in a production environment?

-- 
View this message in context: http://old.nabble.com/Setting-object-from-param-tag-fails-in-Struts-2.2.1-tp30216692p30593987.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


Re: Setting object from param tag fails in Struts 2.2.1

Posted by Lukasz Lenart <lu...@googlemail.com>.
Here you have the whole packages
https://hudson.apache.org/hudson/job/Struts2/lastBuild/org.apache.struts$struts2-assembly/


Kind regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/
Kapituła Javarsovia http://javarsovia.pl

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


Re: Setting object from param tag fails in Struts 2.2.1

Posted by Maurizio Cucchiara <ma...@gmail.com>.
> So should I stay with 2.1.8.1 and wait for 2.2.2?
while waiting for the next release you could download the *latest
build* [1] [2], and see it works as you expect   (please let us know)

[1] https://hudson.apache.org/hudson/job/Struts2/lastBuild/org.apache.struts$struts2-core/
[2] https://hudson.apache.org/hudson/job/Struts2/lastBuild/org.apache.struts.xwork$xwork-core/
-- 
Maurizio Cucchiara

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


Re: Setting object from param tag fails in Struts 2.2.1

Posted by Pro1712 <Pr...@yahoo.de>.
So should I stay with 2.1.8.1 and wait for 2.2.2?
When will this version be released?



Maurizio Cucchiara wrote:
> 
> As far as I know this behavior was fixed with the patch sent by Lukasz
> (see [1] and also [2]).
> I can't figure out what happened, as far I can see in subversion logs
> [3] the patch was submitted three months ago, though source code of
> last struts2 version contains the old version of ChainInterceptor.
> 
> 
> [1] https://issues.apache.org/jira/browse/WW-3503
> [2] https://issues.apache.org/jira/browse/WW-3488
> [3]
> http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/interceptor/ChainingInterceptor.java?p2=/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/interceptor/ChainingInterceptor.java&p1=/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/interceptor/ChainingInterceptor.java&r1=997345&r2=997344&view=diff&pathrev=997345
> 

-- 
View this message in context: http://old.nabble.com/Setting-object-from-param-tag-fails-in-Struts-2.2.1-tp30216692p30584769.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


Re: Setting object from param tag fails in Struts 2.2.1

Posted by Maurizio Cucchiara <ma...@gmail.com>.
As far as I know this behavior was fixed with the patch sent by Lukasz
(see [1] and also [2]).
I can't figure out what happened, as far I can see in subversion logs
[3] the patch was submitted three months ago, though source code of
last struts2 version contains the old version of ChainInterceptor.


[1] https://issues.apache.org/jira/browse/WW-3503
[2] https://issues.apache.org/jira/browse/WW-3488
[3] http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/interceptor/ChainingInterceptor.java?p2=/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/interceptor/ChainingInterceptor.java&p1=/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/interceptor/ChainingInterceptor.java&r1=997345&r2=997344&view=diff&pathrev=997345

2010/12/23 Dave Newton <da...@gmail.com>:
> On Thu, Dec 23, 2010 at 7:30 AM, Pro1712 wrote:
>
>> I use this action:
>> <mm:action name="ActionLinksAction" executeResult="true"
>> ignoreContextParams="true">
>>        <mm:param name="direction" value="'vertical'" />
>>        <mm:param name="position" value="'anlegen'" />
>>        <mm:param name="cssIconStyle" value="'item_header_table_backcolor'"
>> />
>> </mm:action>
>>
>> ActionLinksAction has this method:
>> public void setActionLinks(final LinkedHashMap<String, Object> actionLinks)
>> {
>>        actionLinks_ = actionLinks;
>> }
>>
>> This should be filled from the context.
>>
>
> Why/how? The action tag will just push the action onto the stack and set the
> parameters you've defined. There's no context copy into the new action, if I
> remember correct (which I may well not).
>
>
>> The page from which the action is called has a property getActionLinks and
>> returns the data.
>>
>
> That would return the actionLinks from the *original* action, because it's
> the first object on the stack with a publicly-accessible getter, no? I don't
> see why the action being called would have setActionLinks() called.
>
> Dave
>



-- 
Maurizio Cucchiara

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


Re: Setting object from param tag fails in Struts 2.2.1

Posted by Dave Newton <da...@gmail.com>.
On Thu, Dec 23, 2010 at 7:30 AM, Pro1712 wrote:

> I use this action:
> <mm:action name="ActionLinksAction" executeResult="true"
> ignoreContextParams="true">
>        <mm:param name="direction" value="'vertical'" />
>        <mm:param name="position" value="'anlegen'" />
>        <mm:param name="cssIconStyle" value="'item_header_table_backcolor'"
> />
> </mm:action>
>
> ActionLinksAction has this method:
> public void setActionLinks(final LinkedHashMap<String, Object> actionLinks)
> {
>        actionLinks_ = actionLinks;
> }
>
> This should be filled from the context.
>

Why/how? The action tag will just push the action onto the stack and set the
parameters you've defined. There's no context copy into the new action, if I
remember correct (which I may well not).


> The page from which the action is called has a property getActionLinks and
> returns the data.
>

That would return the actionLinks from the *original* action, because it's
the first object on the stack with a publicly-accessible getter, no? I don't
see why the action being called would have setActionLinks() called.

Dave

Re: Setting object from param tag fails in Struts 2.2.1

Posted by Pro1712 <Pr...@yahoo.de>.
Hi!

I'm updating from Struts 2.1.8.1 to 2.2.1.1.

I use this action:
<mm:action name="ActionLinksAction" executeResult="true"
ignoreContextParams="true">
	<mm:param name="direction" value="'vertical'" />
	<mm:param name="position" value="'anlegen'" />
	<mm:param name="cssIconStyle" value="'item_header_table_backcolor'" />
</mm:action>

ActionLinksAction has this method:
public void setActionLinks(final LinkedHashMap<String, Object> actionLinks)
{
	actionLinks_ = actionLinks;
}

This should be filled from the context.
The page from which the action is called has a property getActionLinks and
returns the data.


This works in 2.1.8.1 but not in 2.2.1.1!
I did not change any code. I only updated the libs.

Is there any change from 2.1.8.1 to 2.2.1.1?






Maurizio Cucchiara wrote:
> 
> 2010/11/17 Raj Nagappan <ra...@velocitylabs.com>
> 
>>
>> I would say this is a regression bug from 2.0.x, yes?
>>
>>
> I guess you're right.
> Take a look at https://issues.apache.org/jira/browse/WW-1960
> Could you open an issue, referencing the one above?
> I'm sure someone helps you.
> In the meanwhile could you try to change action's behavior?
> 
> <s:action namespace="/search" name="KeywordList" executeResult="true"
> ignoreContextParams="true">
> <%--REMOVE THIS LINE <s:param name="keywordList"
> value="photoSet.keywordListLazyLoad"/>--%>
> </s:action>
> 
> and create a new method inside your KeywordList action called set
> KeywordListLazyLoad()
> -- 
> Maurizio Cucchiara
> 
> 

-- 
View this message in context: http://old.nabble.com/Setting-object-from-param-tag-fails-in-Struts-2.2.1-tp30216692p30520424.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