I'm using Tiles 2.0 with Struts2 and what I'm trying to do is populate an action bean from the value stack, i.e.
<s:property value="myBean.cod1"/>
would populate something like AS0000123
Now, what happens if in my tile's definition I have something like this:
<definition name="fieldPurpose1" template="fieldPurposeTemplate.jsp">
<put-attribute name="field" value="myBean.cod1"/>
</definition>
And so, in the template I'm trying to:
<s:set name="fieldSimple"><tiles:insertAttribute name="field"/></s:set>
<s:property value="%{#fieldSimple}"/>
But what I get is the text myBean.cod1
not the populated one.
Any ideas?
The value is the key, and you can use this key to find another value using OGNL index reference operator.
<s:set name="fieldSimple"><tiles:insertAttribute name="field"/></s:set>
<s:property value="%{#attr[#fieldSimple]}"/>