項目開發中要求列表顯示要明顯看到總條目數,所以就要求序號從1開始。
如下為從1開始的序號展示:
<s:iterator value="#request.pageView.records" var="model" status="stat"> <tr> <td width="20%">${(request.pageView.currentpage-1)*request.pageView.maxresult+stat.count}</td> </tr> </s:iterator>
currentpage:表示當前頁碼
maxresult:每頁顯示條數
stat.count:iterator的索引為stat.index(從0開始),stat.count(從1開始)。