You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Jim Steinberger (JIRA)" <ta...@jakarta.apache.org> on 2006/12/15 22:23:21 UTC

[jira] Created: (TAPESTRY-1193) .script files: "index" property of "foreach" tag is stored as a String, not an integer

.script files: "index" property of "foreach" tag is stored as a String, not an integer
--------------------------------------------------------------------------------------

                 Key: TAPESTRY-1193
                 URL: http://issues.apache.org/jira/browse/TAPESTRY-1193
             Project: Tapestry
          Issue Type: Bug
          Components: Framework
    Affects Versions: 4.0.2
            Reporter: Jim Steinberger
            Priority: Minor


In .script files, the "index" value of the "foreach" tag is stored as a String, not an integer.

If you have a two-dimensional array stored in the input-symbol "matrix", the following will work fine:
  ${matrix[0].length}

But the following, where "matrixIndex" is the symbol used for a surrounding "foreach"-tag's "index" value, will throw an error:
  ${matrix[matrixIndex].length}

The error will tell you that "matrix" does not have the property: 0.
i.e. since matrixIndex is a String, it's looking for a property of the array-object named "0".

This issue doesn't arise with comparisons, such as ${matrixIndex > 0}, because OGNL knows to interpret matrixIndex as an integer.  However, again, in the case of indexes to [ ], both an integer and String parameter are acceptable, so no implicit casting is done on the String.

A workaround:  ${matrix[@java.lang.Integer@parseInt(matrixIndex)].length}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Resolved: (TAPESTRY-1193) .script files: "index" property of "foreach" tag is stored as a String, not an integer

Posted by "Jesse Kuhnert (JIRA)" <de...@tapestry.apache.org>.
     [ https://issues.apache.org/jira/browse/TAPESTRY-1193?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jesse Kuhnert resolved TAPESTRY-1193.
-------------------------------------

       Resolution: Fixed
    Fix Version/s:     (was: 4.2)
                   4.1.2
         Assignee: Jesse Kuhnert

Think its been fixed now, if not please open an issue in http://jira.opensymphony.com/browse/OGNL .

> .script files: "index" property of "foreach" tag is stored as a String, not an integer
> --------------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-1193
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-1193
>             Project: Tapestry
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: 4.0.2
>            Reporter: Jim Steinberger
>            Assignee: Jesse Kuhnert
>            Priority: Minor
>             Fix For: 4.1.2
>
>
> In .script files, the "index" value of the "foreach" tag is stored as a String, not an integer.
> If you have a two-dimensional array stored in the input-symbol "matrix", the following will work fine:
>   ${matrix[0].length}
> But the following, where "matrixIndex" is the symbol used for a surrounding "foreach"-tag's "index" value, will throw an error:
>   ${matrix[matrixIndex].length}
> The error will tell you that "matrix" does not have the property: 0.
> i.e. since matrixIndex is a String, it's looking for a property of the array-object named "0".
> This issue doesn't arise with comparisons, such as ${matrixIndex > 0}, because OGNL knows to interpret matrixIndex as an integer.  However, again, in the case of indexes to [ ], both an integer and String parameter are acceptable, so no implicit casting is done on the String.
> A workaround:  ${matrix[@java.lang.Integer@parseInt(matrixIndex)].length}

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Updated: (TAPESTRY-1193) .script files: "index" property of "foreach" tag is stored as a String, not an integer

Posted by "Jesse Kuhnert (JIRA)" <ta...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/TAPESTRY-1193?page=all ]

Jesse Kuhnert updated TAPESTRY-1193:
------------------------------------

    Fix Version/s: 4.2

> .script files: "index" property of "foreach" tag is stored as a String, not an integer
> --------------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-1193
>                 URL: http://issues.apache.org/jira/browse/TAPESTRY-1193
>             Project: Tapestry
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: 4.0.2
>            Reporter: Jim Steinberger
>            Priority: Minor
>             Fix For: 4.2
>
>
> In .script files, the "index" value of the "foreach" tag is stored as a String, not an integer.
> If you have a two-dimensional array stored in the input-symbol "matrix", the following will work fine:
>   ${matrix[0].length}
> But the following, where "matrixIndex" is the symbol used for a surrounding "foreach"-tag's "index" value, will throw an error:
>   ${matrix[matrixIndex].length}
> The error will tell you that "matrix" does not have the property: 0.
> i.e. since matrixIndex is a String, it's looking for a property of the array-object named "0".
> This issue doesn't arise with comparisons, such as ${matrixIndex > 0}, because OGNL knows to interpret matrixIndex as an integer.  However, again, in the case of indexes to [ ], both an integer and String parameter are acceptable, so no implicit casting is done on the String.
> A workaround:  ${matrix[@java.lang.Integer@parseInt(matrixIndex)].length}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org