ssm框架中使用pagehelper分页

pom.xml中引入mysql

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

在applicationContext.xml中加入
git

<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);
github

controller 中使用
sql

页面的调用
segmentfault

更多精彩文章请关注 王明昌博客
相关文章
相关标签/搜索