<c:set var="perPage" scope="session" value="20" ></c:set>
<c:forEach var="boundaryStart" begin="0" end="${totalCount - 1}"
step="${perPage}">
<a href="?start=<c:out value="${boundaryStart}"/>"> [ <c:out
value="${boundaryStart}" /> - <c:out
value="${boundaryStart + perPage - 1}" /> ] </a>
</c:forEach>
<c:forEach var="current" varStatus="status" begin="${param.start}"
end="${param.start + perPage - 1}">
<c:if test="${status.first}">
<ul>
</c:if>
<li>
<c:out value="${current}" />
</li>
<c:if test="${status.last}">
</ul>
</c:if>
</c:forEach>
得益於下面的幫助: