0
我正在使用Struts iterator標記並嘗試在1次迭代中獲取我列表中的3個元素。struts2迭代器標記幫助
這就是我所擁有的。
<s:iterator status="stat" value="(secondResultSet.size()/3).{ #this}" >
<s:property value="#stat.count" /> <!-- Note that "count" is 1-based, "index" is 0-based. -->
<s:property value="%{secondResultSet.get(#stat.index).altId}"/>
<s:property value="%{secondResultSet.get(#stat.index+1).altId}"/>
<s:property value="%{secondResultSet.get(#stat.index+2).altId}"/>
</s:iterator>
我的清單有18個元素,在一次迭代中,我想打印出3個元素。這就是爲什麼我將列表長度除以3.所以循環將運行6次...總共打印出18個元素。
對於這個例子不同的altId我的列表包含:41 - 58(18)。但是,我打印的代碼如下
First Iteration: 41 42 43
Second Iteration: 42 43 44
Third Iteration: 43 44 45
所以看起來好像計數器沒有更新。有人可以幫我弄這個嗎?