在SSM框架的项目中使用pageHelper插件实现分页查询
- 在项目的pom.xml中添加pagehelper安装依赖
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.1.2</version>
</dependency>
- 在applicationContext.xml中添加pagehelper分页配置文件
注意: 设置<prop key="resonable">true</prop>
当点击上一页和下一页时,page值超出查询范围时不会导致查询错误
<property name="plugins">
<array>
<bean class="com.github.pagehelper.PageInterceptor">
<property name="properties">
<props>
<prop key="helperDialect">mysql</prop>
<prop key="resonable">true</prop>
</props>
</property>