Andreas Andreou wrote: > Not having to create getters & setters (or abstract getters in T4) just so > that @Loop (and @For) values and indexes can > become accessible is a fairly often request/question... > > Creating a custom binding prefix (perhaps named temp) that attaches objects > to the currect requestcycle > and reads from them looks like an elegant solution - of course, the temp > binding would also need to support > object navigation if it's going to be of any value, so perhaps it could > reuse parts of the prop binding? > If I'm not mistaken, prop binding uses static type of the property to build the accessors, so you cannot use it in cases the type is not known during page loading time.
In my project I've implemented OGNL binding and put the "state" Map (which is local to the component and request lifecycle) into the ognl root context, so I can, for example, write loops like: <t:loop source="data" value="ognl:#state.current"> <t:if test="ognl:#state.current.key != null"> Key: ${ognl:#state.current.key} </t:if> </t:loop> Of course, this sacrifices the performance a bit, since OGNL will be slower (probably, much slower) than PropBinding. -- WBR, Ivan S. Dubrov
signature.asc
Description: OpenPGP digital signature