You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Paul Ferraro <pm...@columbia.edu> on 2003/11/03 00:08:48 UTC

OGNL: Trouble accessing map entries

This is really an OGNL question, and I've posted the questio****n to ognl-interest@lists.ognl.org, but I have not yet received a reply.  Maybe a fellow Tapestry user can help.

I am getting an error accessing a Map entry using a dynamically generated property name.

Static expression like this work:

myMap["myProperty"]   => corresponds to myMap.get("myProperty")

But complex expressions like this are not working (see stack trace below):

myMap["myProperty" + index]


org.apache.tapestry.BindingException: Unable to resolve expression 'dataMap['person' + i + 'Name']'
Caused by:
ognl.OgnlException: current node is not a property node for 'person1Name'
  at ognl.MapPropertyAccessor.getProperty(MapPropertyAccessor.java:53)
  at ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1443)
  at ognl.ASTProperty.getValueBody(ASTProperty.java:96)
  at ognl.SimpleNode.getValue(SimpleNode.java:192)
  at ognl.ASTChain.getValueBody(ASTChain.java:109)
  at ognl.SimpleNode.getValue(SimpleNode.java:192)
  at ognl.Ognl.getValue(Ognl.java:335)
  at ognl.Ognl.getValue(Ognl.java:310)

Any clues?

Paul Ferraro