struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maxx <>
Subject Evaluate a string property containing some OGNL expression
Date Fri, 15 Feb 2008 11:51:59 GMT

As I wasn't able to find this out at the moment, I'm posting my question here :

Would it be possible, within Struts2 tags, to evaluate a (String)
property which contains the OGNL expression referring to an other

Example :

	<s:set name="testValue" value="%{12}" />
	testValue = <s:property value="#testValue" /> // print 1
	<s:set name="testValueName" value="%{'testValue'}" />
	testValueName = <s:property value="#testValueName" /> // print testValue

	testValue (via xxxName) = <s:property value="%{%{#testValueName}}" />
// print nothing!!!

Why I'm wanting this ?
This might be tricky but because I'm getting complex OGNL expressions like

I'd like to set my OGNL "prefix" with a simple set
<s:set name="myPrefix"
value="%{'myObj.someSubList(X).someSubMap[Y](Z).subObj.'}" />
and then for each property call use something like
	%{#myPrefix + 'fieldName'}

But unfortunately I'm unable to make it work at the moment.

Could please someone explain me what I'm doing wrong?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message