struts-user mailing list archives

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

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
property??

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
myObj.someSubList(X).someSubMap[Y](Z).subObj.fieldName

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?

Thanks,
Maxx

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message