分页求助大佬
程序员文章站
2024-02-20 08:13:52
...
<div class="box-tools pull-right">
<ul class="pagination" id="ul">
<li><a href="${pageContext.request.contextPath}/findAllOreders?pageNum=1&pageSize=3" aria-label="Previous">首页</a></li>
<li><a href="${pageContext.request.contextPath}/findAllOreders?pageNum=${pi.pageNum-1}&pageSize=${pi.pageSize}">上一页</a></li>
<%--<li><a href="${pageContext.request.contextPath}/findAllOreders?pageNum=${pi.pageNum-2}&pageSize=${pi.pageSize}" </li>--%>
<c:forEach items="${pi.navigatepageNums}" var="i">
<li><a href="${pageContext.request.contextPath}/findAllOreders?pageNum=${i}&pageSize=${pi.pageSize}">${i}</a></li>
</c:forEach>
<li><a href="${pageContext.request.contextPath}/findAllOreders?pageNum=${pi.pageNum+1}&pageSize=${pi.pageSize}">下一页</a></li>
<li><a href="${pageContext.request.contextPath}/findAllOreders?pageNum=${pi.pages}&pageSize=${pi.pageSize}" aria-label="Next">尾页</a></li>
</ul>
</div>
这样写分页会显示所有页码,但是我想显示当前页和前后两页,怎么做啊,数据是从controller类传过来的,
matis的插件pageInfo的数据
@RequestMapping("findAllOreders")
public String findAllOreders(Model model, @RequestParam(defaultValue = "1") Integer pageNumber, @RequestParam(defaultValue = "3") Integer pageSize){
PageInfo<Orders> pageInfo=ordersService.findAllOrders(pageNumber,pageSize);
model.addAttribute("pi",pageInfo);
return "forward:/pages/order-list.jsp";
}
上一篇: Linux环境下shell脚本中调用另一个shell脚本
下一篇: Unix 脚本编程基础