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 中使用


页面的调用


更多精彩文章请关注 王明昌博客

评论

暂无评论