jsp页面中怎样实现数据分页和翻页,已经拿到单页数据size,total,及page,这个具体怎样实现呢?
<c:choose>
<c:when test="${!empty items}">
<c:forEach items="${items}" var="item">
<tr>
<td>${item.name}</td>
<td>${item.phone}</td>
<td>${item.status}</td>
<td>
${util:formatTimestamp(item.registerTime)}
<span class="glyphicon glyphicon-search check-search"></span>
</td>
</tr>
</c:forEach>
</c:when>
<c:otherwise>
<tr>
<td colspan="7">暂时用户信息数量为0!</td>
</tr>
</c:otherwise>
</c:choose>
minmin
10 years, 1 month ago
Answers
<div class="pagination" style="text-align:center;">
<span>共 ${page.count } 条 第 1/${page.pageCount } 页 </span>
<c:if test="${page.pageCount>1 }">
<c:choose>
<c:when test="${page.pageIndex > 1 }">
<a href="${page.uri }1">首页</a>
<a href="${page.uri }${page.pageIndex - 1 }">上一页</a>
</c:when>
<c:otherwise>
<span class="disabled">首页</span>
<span class="disabled">上一页</span>
</c:otherwise>
</c:choose>
<c:if test="${page.start != 1 }">
<span class="split">...</span>
</c:if>
<c:forEach var="i" begin="${page.start }" end="${page.end }">
<c:choose>
<c:when test="${page.pageIndex!=i }">
<a href="${page.uri }${i}">${i}</a>
</c:when>
<c:otherwise>
<span>[${i }]</span>
</c:otherwise>
</c:choose>
</c:forEach>
<c:if test="${page.end != page.pageCount }">
<span class="split">...</span>
</c:if>
<c:choose>
<c:when test="${page.pageIndex < page.pageCount }">
<a href="${page.uri }${page.pageIndex + 1 }">下一页</a>
<a href="${page.uri }${page.pageCount }">末页</a>
</c:when>
<c:otherwise>
<span class="disabled">下一页</span>
<span class="disabled">末页</span>
</c:otherwise>
</c:choose>
</c:if>
</div>
<script>
$(".pagination a").attr("href",function(){
return location.pathname+$(this).attr("href");
})
</script>
Co`Ag
answered 10 years, 1 month ago