how to use struts2 tag to traversal a Map<Object,String> in jsp -


how use struts2 tag traversal map<course,string> in jsp. course class. has 3 attributes. string coursename, int courseid, string coursetype. use struts2 in project. action returns map<course,string> jsp. , use

<s:iterator value="cmap" status="st">   <tr><td>     <s:iterator value='key'><s:property value="key.coursename"/></s:iterator> </td>    <td><s:property value='value'></s:property></td></tr> </s:iterator> 

it can print right string value in jsp. cannot print course type data! how solve it? novice.

you not need second iterator course data. use key values.

<s:iterator value="cmap">   <tr>     <td><s:property value="key.coursename"/></td>     <td><s:property value="value"/></td>   </tr> </s:iterator> 

btw map key custom object annoying thing.


Comments