欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

分页求助大佬

程序员文章站 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";
    }
相关标签: 分页