第一步:导入jsqlparser-0.9.5.jar和pagehelper-5.0.3.jar
第二步:在配置文件添加插件,我的整合项目只保留了spring-mvc.xml
插件配置
第三步:在controller或service实现分页,我的是在controller里实现分页
controller
第四步:jsp显示分页结果
<c:choose>
<c:when test="${pageInfo.size > 0 }">
<div class="feny">
<div class="manu">
<span>显示${pageInfo.startRow }到${pageInfo.endRow}共${pageInfo.total}条</span>
<a href="selectEmpList.do?PageNum=1">首页 </a>
<c:choose>
<c:when test="${pageInfo.hasPreviousPage }">
<a href="selectEmpList.do?PageNum=${pageInfo.pageNum-1}">上一页 </a>
</c:when>
<c:otherwise>
<span>上一页</span>
</c:otherwise>
</c:choose>
<c:forEach var="item" items="${pageInfo.navigatepageNums}">
<c:choose>
<c:when test="${pageInfo.pageNum == item }">
<span class="current">${pageInfo.pageNum }</span>
</c:when>
<c:otherwise>
<a href="selectEmpList.do?PageNum=${item}">${item}</a>
</c:otherwise>
</c:choose>
</c:forEach>
<c:choose>
<c:when test="${!pageInfo.isLastPage }">
<a href="selectEmpList.do?PageNum=${pageInfo.pageNum+1}">下一页 </a>
<a href="selectEmpList.do?PageNum=${pageInfo.lastPage}">尾页</a>
</c:when>
<c:otherwise>
<span>下一页</span>
<span>尾页</span>
</c:otherwise>
</c:choose>
</div>
</div>
</c:when>
<c:otherwise>