ssm框架中使用pagehelper分页

pom.xml中引入

 <dependency>
      <groupId>com.github.pagehelper</groupId>
      <artifactId>pagehelper</artifactId>
      <version>5.1.2</version>
    </dependency>

在applicationContext.xml中加入

<property name="plugins">
            <array>
                <bean class="com.github.pagehelper.PageInterceptor">
                    <property name="properties">
                        <!--使用下面的方式配置参数,一行配置一个 -->
                        <value>
                            helperDialect=mysql
                            offsetAsPageNum=true
                            rowBoundsWithCount=true
                            pageSizeZero=true
                            reasonable=true
                        </value>
                    </property>
                </bean>
            </array>
        </property>

service中使用

service的实现类中使用
PageHelper.startPage(page,size);

controller 中使用

页面的调用

本文由博客一文多发平台 OpenWrite 发布!

猜你喜欢

转载自www.cnblogs.com/wmc1125/p/13210897.html