Re: dynamic ognl expr
Check out some ognl docs for expression syntax, e.t.c. IIRC, you can do value="ognl:components.tableRows.tableRow[columnName]" And happy new year from greece as well ! Martin Strand wrote: > If you generate the expression dynamically, you can use an > ExpressionEvaluator: > > public Object getValue() > { > String expression = "components.tableRows.tableRow." + getColumnName(); > return getExpressionEvaluator().read(getPage(), expression); > } > > @InjectObject("service:tapestry.ognl.ExpressionEvaluator") > public abstract ExpressionEvaluator getExpressionEvaluator(); > > Happy new year > > Martin > > On Sun, 31 Dec 2006 18:18:29 +0100, ra <[EMAIL PROTECTED]> wrote: > >> >> I'd like to read object's property value but the property name is known >> during runtime only >> so finally the ognl expression should looks like this >> >> value="ognl:components.tableRows.tableRow.clientId" >> >> but clientId is generated and can be read i.e. from page's property: >> columnName >> >> So I'd like to write sth like this: >> value="ognl:('components.tableRows.tableRow.' + ognl:columnName)" > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- Andreas Andreou - [EMAIL PROTECTED] - http://andyhot.di.uoa.gr Tapestry / Tacos developer Open Source / J2EE Consulting - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: dynamic ognl expr
If you generate the expression dynamically, you can use an ExpressionEvaluator: public Object getValue() { String expression = "components.tableRows.tableRow." + getColumnName(); return getExpressionEvaluator().read(getPage(), expression); } @InjectObject("service:tapestry.ognl.ExpressionEvaluator") public abstract ExpressionEvaluator getExpressionEvaluator(); Happy new year Martin On Sun, 31 Dec 2006 18:18:29 +0100, ra <[EMAIL PROTECTED]> wrote: I'd like to read object's property value but the property name is known during runtime only so finally the ognl expression should looks like this value="ognl:components.tableRows.tableRow.clientId" but clientId is generated and can be read i.e. from page's property: columnName So I'd like to write sth like this: value="ognl:('components.tableRows.tableRow.' + ognl:columnName)" - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: dynamic ognl expr
Seems like the wrong way to go about things. Remember, it's probably best to avoid complex OGNL expressions. It's often best to add the complexity to the JAVA code. For example you could have a function in your object such that you can do getPropertyByName(columnName). And use that to return the correct property. I am almost sure you can't use dynamic OGNL expressions like you want since those are usually pre-compiled. On 12/31/06, ra <[EMAIL PROTECTED]> wrote: I'd like to read object's property value but the property name is known during runtime only so finally the ognl expression should looks like this value="ognl:components.tableRows.tableRow.clientId" but clientId is generated and can be read i.e. from page's property: columnName So I'd like to write sth like this: value="ognl:('components.tableRows.tableRow.' + ognl:columnName)" -- View this message in context: http://www.nabble.com/dynamic-ognl-expr-tf2902234.html#a8108480 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
dynamic ognl expr
I'd like to read object's property value but the property name is known during runtime only so finally the ognl expression should looks like this value="ognl:components.tableRows.tableRow.clientId" but clientId is generated and can be read i.e. from page's property: columnName So I'd like to write sth like this: value="ognl:('components.tableRows.tableRow.' + ognl:columnName)" -- View this message in context: http://www.nabble.com/dynamic-ognl-expr-tf2902234.html#a8108480 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]