Due to Java type erasure, Map<String,String> at compile time becomes
Map<Object,Object> at runtime. The type information is lost, so the
prop binding prefix has no type information to work from.

In addition, the prop binding prefix works directly from JavaBeans
specification (whereas OGNL fudges it a bit to make Map keys act like
JavaBeans properties).

This could be addressed in a couple of ways; special cases inside the
prop binding factory for Maps (to let you go one level in, perhaps),
maybe a little bit more w.r.t. accessing runtime generic type data via
reflection, or a special map: binding prefix.  None of these are
exactly ... satisfying ... but that's not the point; productivity is
the point.

On 3/19/07, Peter Beshai <[EMAIL PROTECTED]> wrote:
Is there any current way of using expansions to get properties from a map? I
have an object with a properties field of type Map<String, String> and I
think it would be nice if I could ${myobj.properties.mykey} to get the value
out. As far as I can tell this doesn't work and the workaround is to define
properties in my page for each of the entries in the map.

Is there a better way of handling maps?

Thanks :-)

--
Peter Beshai

Pure Mathematics/Computer Science Student
University of Waterloo



--
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to