我记得有个插件分页插件,后端你搜一下记不住了就是针对ssm的,我找了一下是
<dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper</artifactId> <version>5.0.0</version> </dependency> <dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper-spring-boot-autoconfigure</artifactId> <version>1.2.3</version> </dependency> <dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper-spring-boot-starter</artifactId> <version>1.2.3</version> </dependency>
这个
嗯
后端Controll返回值到Jsp页面,使用Model存储参数,El直接$获取。
<c:if test="${not empty page.totalPageCount}">
<div class="pager" align="center">
<font size="2">共 ${page.totalPageCount} 页</font> <font size="2">第
${page.pageNow} 页</font> <a href="handle_limit?pageNow=1">首页</a>
<c:choose>
<c:when test="${page.pageNow - 1 > 0}">
<a href="handle_limit?pageNow=${page.pageNow - 1}">上一页</a>
</c:when>
<c:when test="${page.pageNow - 1 <= 0}">
<a href="handle_limit??pageNow=1">上一页</a>
</c:when>
</c:choose>
<c:choose>
<c:when test="${page.totalPageCount==0}">
<a href="handle_limit?pageNow=${page.pageNow}">下一页</a>
</c:when>
<c:when test="${page.pageNow + 1 < page.totalPageCount}">
<a href="handle_limit?pageNow=${page.pageNow + 1}">下一页</a>
</c:when>
<c:when test="${page.pageNow + 1 >= page.totalPageCount}">
<a href="handle_limit?pageNow=${page.totalPageCount}">下一页</a>
</c:when>
</c:choose>
<c:choose>
<c:when test="${page.totalPageCount==0}">
<a href="handle_limit?pageNow=${page.pageNow}">尾页</a>
</c:when>
<c:otherwise>
<a href="handle_limit?pageNow=${page.totalPageCount}">尾页</a>
</c:otherwise>
</c:choose>
</div>
</c:if>