java - Accessing Map attribute with dynamic key in Struts 2 OGNL -
i have list of strings attribute names , map. i'm trying access model(ex.project) in map using attribute name in string list.
here have now.
<s:iterator value="themap" var="element"> <tr> <s:iterator value="attributelist" var="attrname"> <td><p><s:property value="#element.project.#attrname" /></p></td> </s:iterator> </tr> </s:iterator>
if hard code attribute name works fine:
<td><p><s:property value="#element.project.projectname" /></p></td>
any advice appreciated.
using ognl <s:property value="#element.project[#attrname]" />
Comments
Post a Comment