6
我有list
其中包含一些對象。這些對象有一個hours
字段。如何更新<c:set>標籤中的值使用內部012的<c:foreach>標籤
在<c:foreach>
我迭代列表並獲取對象。
現在我想總結totalHours
變量中所有迭代對象的hours
字段。
我的代碼:
<c:forEach var="attendance" items="${list }" varStatus="rowCounter1">
<tr>
<td><c:out value="${rowCounter1.count}"></c:out></td>
<td><c:out value="${attendance.date }"></c:out></td>
<td><c:out value="${attendance.inTime }"></c:out></td>
<td><c:out value="${attendance.outTime }"></c:out></td>
<td><c:out value="${attendance.interval }"></c:out></td>
<c:set var="totalHours" value="${attendance.Hours += attendance.Hours }"
target="${attendance}"</c:set>
</tr>
</c:forEach>
我是想這一點,但它給了我下面的錯誤:
javax.el.ELException: Failed to parse the expression [${attendance.Hours += attendance.Hours }
你想設置'totalHours'嗎?以什麼價值? – 2012-07-31 07:23:27