struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lukasz Lenart <lukaszlen...@apache.org>
Subject Re: Struts 2 JSON plugin change in finding the target action instance problem Pavel Ilyushko Original Poster Greenhorn Joined: Nov 05, 2014 Posts: 1
Date Wed, 05 Nov 2014 12:47:00 GMT
2014-11-05 13:41 GMT+01:00 Pavel Ilyushko <pavel.ilyushko@gmail.com>:
> Hi there!
>
> Thanks for a swift reply.
>
> Actually, re-defining the root is what I applied as a work-around.
>
> So in my struts.xml I have this (to fix setting the parameters on the
> action):
>
>                 <interceptor-ref name="json">
>                      <param name="root">action</param>
>                 </interceptor-ref>
>
> and also for each json action type I have this (to set the action fields
> for json response) :
>
>             <result type="json">
>                  <param name="root">action</param>
>             </result>
>
> Note, I'm using 'action' as the root. I found this in the code:
>
> http://grepcode.com/file/repo1.maven.org/maven2/org.apache.struts.xwork/xwork-core/2.3.16.3/com/opensymphony/xwork2/DefaultActionInvocation.java?av=f
>
> see code for
>
>  public void  <http://grepcode.com/file/repo1.maven.org/maven2/org.apache.struts.xwork/xwork-core/2.3.16.3/com/opensymphony/xwork2/DefaultActionInvocation.java?av=f#>init
> <http://grepcode.com/file/repo1.maven.org/maven2/org.apache.struts.xwork/xwork-core/2.3.16.3/com/opensymphony/xwork2/ActionInvocation.java#ActionInvocation.init%28com.opensymphony.xwork2.ActionProxy%29>(ActionProxy
> <http://grepcode.com/file/repo1.maven.org/maven2/org.apache.struts.xwork/xwork-core/2.3.16.3/com/opensymphony/xwork2/ActionProxy.java#ActionProxy>
> proxy) method, line 401:
>
>         if (pushAction) {
>             stack.push(action);
>             contextMap.put("action", action);
>         }
>
> As you can see, the "action" key is hard coded and specified nowhere in the
> official struts 2 doc. So it's kind of dangerous to rely on this key, since
> it might change in the future without notification.
>
> Is there a cleaner way to redefine the root, as you've suggested?

It won't change, please register an issue against documentation to
clarify this :-)


Regards
-- 
Ɓukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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


Mime
View raw message