1、在该SSM工程的pom.xml中加入PageHelper的分页插件依赖(若是版本号不对,可以尝试修改一下)
1
2
3 com.github.miemiedev
4 mybatis-paginator
5 1.2.15
6
7
8 com.github.pagehelper
9 pagehelper
10 3.4.2-fix
11
2、在myBatis的配置文件中(SqlMapConfig.xml)加入分页插件的依赖:(下面这是SqlMapConfig.xml中的全部内容)
1 <?xml version="1.0" encoding="UTF-8" ?>
2 /p>
4 "http://mybatis.org/dtd/mybatis-3-config.dtd">
5
6
7
8
9
10
11
12
13
14
3、在spring整合文件(xml)中加入下面这句话:
1
2
别忘加对Maven工程进行Maven install!!!!!!
4、ServiceImpl(此处我的EUDataGridResult是我返回给前台的一个实体类,把list集合封装起来了)
EUDataGridResult:
5、Controller
6、我前台测试代码,界面比较丑,人家是用异步Ajax请求,我就简单模拟了一下:
页面:
7、结果如下:(我总共有十条数据,查询第三页,每页有四条数据)
原文:https://www.cnblogs.com/rgever/p/9455741.html