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

頁面的調用 app

更多精彩文章請關注 王明昌博客code

相關文章
相關標籤/搜索