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

Mike Calmus commented on WW-2480:
---------------------------------

The UIBena parent class does the following:

        String name = null;
        String providedLabel = null;

        if (this.key != null) {

            if(this.name == null) {
                this.name = key;
            }

            if(this.label == null) {
                // lookup the label from a TextProvider (default value is the 
key)
                providedLabel = TextProviderHelper.getText(key, key, stack);
            }

        }

        if (this.name != null) {
            name = findString(this.name);
            addParameter("name", name);
        }

As you can see the "name" that gets put into the value map is different than 
the value stored for the class member variable. The key here is that we need 
name after it has been run through the findString method. I did the change to 
DateTimePicker because I figured there must be some reason for this behavior 
and didn't want to take a chance on breaking something elsewhere by changing 
UIBean itself.

> Some OGNL expressions do not work with DateTimePicker component
> ---------------------------------------------------------------
>
>                 Key: WW-2480
>                 URL: https://issues.apache.org/struts/browse/WW-2480
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Dojo Tags
>    Affects Versions: 2.0.11, 2.0.11.1, 2.0.12, 2.1.0, 2.1.1
>            Reporter: Mike Calmus
>            Priority: Blocker
>
> Certain expressions do not parse when using the DateTimePicker tag. This same 
> expression works fine with the textfield tag:
> The following line throws a parse exception.
>         <s:datetimepicker name="aList.get(%{#attr['item_rowNum'] - 
> 1}).startDate" />
> whereas this works fine:
>         <s:textfield name="aList.get(%{#attr['item_rowNum'] - 1}).startDate" 
> />
> The problem seems to be that the latter uses the standard UIBean 
> evaluateParams()  implementation whereas the former overrides it. This caused 
> a problem with a third-party component as well. Based upon code usage, I 
> believe this may affect other components as well. The following patch should 
> fix both built-in as well as third-party modules:
> Index: core/src/main/java/org/apache/struts2/components/UIBean.java
> ===================================================================
> --- core/src/main/java/org/apache/struts2/components/UIBean.java        
> (revision 620628)
> +++ core/src/main/java/org/apache/struts2/components/UIBean.java        
> (working copy)
> @@ -588,8 +588,6 @@
>          addParameter("templateDir", getTemplateDir());
>          addParameter("theme", getTheme());
> -        String name = null;
> -
>          if (this.key != null) {
>             if(this.name == null) {
> @@ -603,8 +601,8 @@
>          }
>          if (this.name != null) {
> -            name = findString(this.name);
> -            addParameter("name", name);
> +            this.name = findString(this.name);
> +            addParameter("name", this.name);
>          }
>          if (label != null) {

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

Reply via email to