You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SpEL currently supports using square brackets '[]' to allow indexed access to arrays and maps. It should also support property lookups on objects. JSP/Unified EL supports this syntax.
For example:
where 'object' is a bean with a method getFoo() { return "bar"; }
and 'field' is string "foo"
#{object[field]}
should resolve to "bar"
Currently, this expression results in a NumberFormatException attempting to coerce "foo" to an integer.
A good general rule of thumb for square brackets should be that unless the target type is an array (or array like), the result of the sub expression in the brackets should be evaluated against the target as if it were attached to the target with a dot '.'
Affects: 3.0.1
Issue Links:
ROO-689 display.tagx should use <spring:eval /> instead of <c:out /> to use custom converters ("is depended on by")
Indexing used to be all powerful (ranges/etc). It was trimmed down for 3.0 - perhaps too much as issues like this show. This is now fixed and I've also addressed the setting case too "foo[bar]=5".
Scott Andrews opened SPR-6968 and commented
SpEL currently supports using square brackets '[]' to allow indexed access to arrays and maps. It should also support property lookups on objects. JSP/Unified EL supports this syntax.
For example:
where 'object' is a bean with a method getFoo() { return "bar"; }
and 'field' is string "foo"
#{object[field]}
should resolve to "bar"
Currently, this expression results in a NumberFormatException attempting to coerce "foo" to an integer.
A good general rule of thumb for square brackets should be that unless the target type is an array (or array like), the result of the sub expression in the brackets should be evaluated against the target as if it were attached to the target with a dot '.'
Affects: 3.0.1
Issue Links:
Referenced from: commits 81b10be
1 votes, 1 watchers
The text was updated successfully, but these errors were encountered: