You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Lukasz Lenart (JIRA)" <ji...@apache.org> on 2014/04/30 12:00:21 UTC
[jira] [Updated] (WW-4336) Action tag does not process list type
parameters correctly
[ https://issues.apache.org/jira/browse/WW-4336?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Lukasz Lenart updated WW-4336:
------------------------------
Description:
Hello Everyone.
While migrating application from struts 2.0.11 to 2.3.15.x encountered below issue -
There is a list of objects available in a jsp, within which an action is invoked ( using s:action tag ) and that list is passed down for use in the callee action (this is being done to populate a table). This approach worked with struts 2.0.11, but with 2.3.15 - the list is being converted to string first before being passed to the callee action and is unusable by the time its received.
With some debugging, figured out this piece of code was doing the conversion to string..
{{ActionComponent.createParametersForContext()}}
{code:java}
String key = (String) entry.getKey();
Object val = entry.getValue();
if (val.getClass().isArray() && String.class == val.getClass().getComponentType()) {
params.put(key, (String[])val);
} else {
params.put(key, new String[]{val.toString()});
}
{code}
relevant code snippet in jsp looks like this
{code:html}
<s:action name="someAction2" executeResult="true" namespace="/common" >
<s:param name="iterable" value="#iter"/>
{code}
Is this an intended change in behavior ? I couldn't find relevant details in the release notes or the migration guide. What's the recommended approach to migrate such components ?
was:
Hello Everyone.
While migrating application from struts 2.0.11 to 2.3.15.x encountered below issue -
There is a list of objects available in a jsp, within which an action is invoked ( using s:action tag ) and that list is passed down for use in the callee action (this is being done to populate a table). This approach worked with struts 2.0.11, but with 2.3.15 - the list is being converted to string first before being passed to the callee action and is unusable by the time its received.
With some debugging, figured out this piece of code was doing the conversion to string..
ActionComponent.createParametersForContext()
String key = (String) entry.getKey();
Object val = entry.getValue();
if (val.getClass().isArray() && String.class == val.getClass().getComponentType()) {
params.put(key, (String[])val);
} else {
params.put(key, new String[]{val.toString()});
}
relevant code snippet in jsp looks like this
<s:action name="someAction2" executeResult="true" namespace="/common" >
<s:param name="iterable" value="#iter"/>
Is this an intended change in behavior ? I couldn't find relevant details in the release notes or the migration guide. What's the recommended approach to migrate such components ?
> Action tag does not process list type parameters correctly
> ----------------------------------------------------------
>
> Key: WW-4336
> URL: https://issues.apache.org/jira/browse/WW-4336
> Project: Struts 2
> Issue Type: Bug
> Components: Core Actions, Plugin - Tags
> Affects Versions: 2.3.15.3
> Reporter: Gautham
> Fix For: 2.3.18
>
>
> Hello Everyone.
> While migrating application from struts 2.0.11 to 2.3.15.x encountered below issue -
> There is a list of objects available in a jsp, within which an action is invoked ( using s:action tag ) and that list is passed down for use in the callee action (this is being done to populate a table). This approach worked with struts 2.0.11, but with 2.3.15 - the list is being converted to string first before being passed to the callee action and is unusable by the time its received.
> With some debugging, figured out this piece of code was doing the conversion to string..
> {{ActionComponent.createParametersForContext()}}
> {code:java}
> String key = (String) entry.getKey();
> Object val = entry.getValue();
> if (val.getClass().isArray() && String.class == val.getClass().getComponentType()) {
> params.put(key, (String[])val);
> } else {
> params.put(key, new String[]{val.toString()});
> }
> {code}
> relevant code snippet in jsp looks like this
> {code:html}
> <s:action name="someAction2" executeResult="true" namespace="/common" >
> <s:param name="iterable" value="#iter"/>
> {code}
> Is this an intended change in behavior ? I couldn't find relevant details in the release notes or the migration guide. What's the recommended approach to migrate such components ?
--
This message was sent by Atlassian JIRA
(v6.2#6252)