<s:iterator value="itemPageList" status="t">
<tr id="<s:property value='id'/>" bgcolor="<s:property value="%{#t.count%2==0?'#c9cdd2':'#e7eaee'}"/>">
迭代的內容
</tr>
</s:iterator>
下面是另外一種
<s:if test="%{#t.index%2==1}">style="background-color:gray;"</s:if>>
參數說明:
first | 是否是第一個元素 |
last | 是否是最後一個元素 |
index | 取得當前遍歷的索引 |
odd | 當前遍歷的索引是否爲奇數 |
even | 當前遍歷的索引是否爲偶數 |
count | 已經遍歷了多少個記錄 |