From: "Craig R. McClanahan" <[EMAIL PROTECTED]> > On Wed, 30 Oct 2002, James Strachan wrote: > > Another idea would be just to patch the JSTL EL implementation to support > > DyanBeans. Right now Jexl does this already... > > > > http://jakarta.apache.org/commons/sandbox/jexl/ > > > > So you could use > > > > ${mydbean.prop} > > > > or > > > > ${mydbean["prop"]} > > > > The Jexl implementation tries to find a bean property first, if it can't > > find it then it looks for a get(String) method and calls that. So DynaBean > > and beans are interchangable in Jexl. > > > > This is fine for things like JEXL. I don't think it is fine for code used > in the reference implementation of JSTL (at least by default. > > Doing this would create situations where applications are dependent on a > particular implementation of JSTL -- perhaps without even knowing about it > -- and will certainly break once the user switches to a JSP 2.0 container > that doesn't have the same sort of modification. > > For Struts, I +1'd adding a getMap() method to ActionDynaForm so that you > could use expressions like "${mybean.map.prop}" on a such a form bean. > However, I don't believe we want to build this into the fundamental > dynabean APIs (especially not into the o.a.c.b.DynaBean interface itself), > because there can easily be uses of DynaBean that do not represent the > dynamic set of properties as a map (consider a DynaBean backed by a > million-row database table that lazily loads rows as you need them), where > implementing a getMap() method would be somewhere between very difficult > and basically impossible.
Agreed. Having a flag to enable this behaviour in JSTL is not ideal. I guess we should wait for the next JSTL / JSP spec revision and consider adding get(String) semantics to the spec so that that things like DynaBeans and mapped properties can be natively supported by JSTL and JSP 2.x. Another idea could be to have a DynaBean implementation or wrapper which adds the getMap() method or just wraps a DynaBean as a Map. Doing this would avoid the DyanBean interface having to change - though folks would have to change their code to use this special wrapper. So not terribly elegant - but at least then some DynaBeans could be used inside current JSTL & JSP. James ------- http://radio.weblogs.com/0112098/ __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- To unsubscribe, e-mail: <mailto:commons-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:commons-user-help@;jakarta.apache.org>
