当前位置: 代码迷 >> J2EE >> struts 2嵌套iterator有关问题
  详细解决方案

struts 2嵌套iterator有关问题

热度:294   发布时间:2016-04-22 03:44:04.0
struts 2嵌套iterator问题
我现在有一个List: List<TrainingCourseClassAttendHistory> trainingCourseClassAttendHistory;
在这个List中还有另一个集合:
public class TrainingCourseClassAttendHistory implements java.io.Serializable {
  ......
private Set<TrainingCourseClassAttendPeriod> trainingCourseClassAttendPeriod = null;
  set/get方法;
  ......
}
我现在要在JSP页面中用s:iterator遍历trainingCourseClassAttendHistory,在这个遍历中还要遍历内部的集合.....
请有经验的大师给指导一下。
<s:if test="trainingCourseClassAttendHistory!=null">
<s:iterator value="trainingCourseClassAttendHistory" status="stat">
<tr>
<td>
<s:property value="test" default=""/>
</td>
<td>
<s:property value="test" default=""/>
</td>
<td>
就是这里不知道怎么做了。
<%--<s:property value="%{trainingCourseClassAttendHistory[#stat.index].}"/>
--%>
</td>
<td>
<s:property value="%{trainingCourseClassAttendHistory[#stat.index].attendPercentage}" default="0" />
</td>
<td>
<s:property value="%{trainingCourseClassAttendHistory[#stat.index].cpdId}" default="0" />
</td>
<td>
<s:property value="%{trainingCourseClassAttendHistory[#stat.index].mpfCpdCore}" default="0" />
</td>
<td>
<s:property value="%{trainingCourseClassAttendHistory[#stat.index].mpfCpdNonCore}" default="0" />
</td>
<td>
<s:property value="%{trainingCourseClassAttendHistory[#stat.index].cpt}" default="0" />
</td>
</tr>
</s:iterator>

------解决方案--------------------
Java code
      <s:iterator value="listR" var="devil">      <tr class=Off onMouseOut="this.className='Off'" onMouseOver="this.className='Up'">        <td height="24"><div align="center">            <input type="checkbox" name="id" value="<s:property value='#devil.r_id'/>" id="id">        </div></td>        <td><div align="center"><s:property value="#devil.r_id"/></div></td>        <td><div align="center">      <s:property value="#devil.r_name"/></div></td>        <td><div align="center"><s:property value="#devil.r_depict"/></div></td>        <td><div align="center">            <div align="center">            <div align="center"><s:iterator var="o" value="#devil.states"><s:property value="#o.s_name"/>、</s:iterator> </div>            </div>        </div></td>        <td><div align="center"><a href="<%=basePath%>system/updaterole.jsp?id=${devil.r_id}">        <img src="<%=basePath%>images/edit.gif" width="16" height="19" border="0"></a></div>            <div align="center"></div></td>      </tr>      </s:iterator>
------解决方案--------------------
探讨
引用:

Java code

<s:iterator value="listR" var="devil">
<tr class=Off onMouseOut="this.className='Off'" onMouseOver="this.className='Up'">
<td height="24"><div align="center">
  相关解决方案