You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Claudio Pozzoli (JIRA)" <ji...@apache.org> on 2009/06/17 17:52:42 UTC

[jira] Commented: (WW-1960) action tag violates ParameterAware contract

    [ https://issues.apache.org/struts/browse/WW-1960?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46389#action_46389 ] 

Claudio Pozzoli commented on WW-1960:
-------------------------------------

Doesn't this patch break some (legal?) usages of the "s:action" tag as well? We were used to pass actual objects to the action in order to create handy "widgets" used across the whole site, e.g.:


struts-widgets.xml:

<package name="widgets" namespace="/widgets" extends="struts-default">
    <default-interceptor-ref name="i18nStack" />
    ...
    <action name="dummyService" class="com.examples.widgets.ServicesAction" method="dummyService">
	<result>dummyServiceWidget.jsp</result>
    </action>
    ...
</package>


container.jsp:

<s:action namespace="/widgets" name="dummyService" executeResult="true">
    <s:param name="actualParam"     value="expensiveObject.beanList[index]" />
</s:action>


ServicesAction.java:

public class ServicesAction extends ActionSupport
{
    ... 
    // parameters
    private BeanType actualParam;

    public String dummyService() throws Exception
    {
        // use actualParam object...
    }

    public void setActualParam(BeanType actualParam)
    {
        this.actualParam = actualParam;
    }
    ...
}


This is a useful feature every time "s:action" gets repeatedly evaluated over a collection of parameters (getting back the object from a string identifier passed as parameter is not an option since it would be computationally expensive in our case).

Claudio

> action tag violates ParameterAware contract
> -------------------------------------------
>
>                 Key: WW-1960
>                 URL: https://issues.apache.org/struts/browse/WW-1960
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions: 2.0.6, 2.0.7, 2.0.8, 2.0.9, 2.0.10
>         Environment: linux,jdk1.5,tomcat5.5
>            Reporter: David Mansfield
>            Assignee: Don Brown
>            Priority: Minor
>             Fix For: 2.1.0
>
>
> the javadoc for ParameterAware states that the values of the map are all java.lang.String[], in other words it is a Map<String,String[]>.  Indeed, when hitting an action via a 'genuine' http request, this is true.  However, when hitting the action via the action tag, the values in the map are String, not String[].  The bug appears to be possibly line 177 in ActionComponent:
> 176:        if (parameters != null) {
> 177:            newParams.putAll(parameters);
> 178:        }
> The parameters of the component are Map<String,String> and therefore cannot be combined directly into the ActionContext.getParameters map.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.