实习日记Day06:ssm分页
分页的步骤:
(1)导入jar包
在pom.xml中添加以下依赖
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.1.2</version>
</dependency>
(2)在页面的请求路径加上page=…,size=…
(3)service层在执行dao层方法之前使用PageHelper
(4) controller层将pageinfo对象作为参数传给mv
注意:applicationContext增加
<property name="plugins">
<array>
<bean class="com.github.pagehelper.PageInterceptor">
<property name="properties">
<props>
<prop key="helperDialect">mysql</prop>
<prop key="reasonable">true</prop>
</props>
</property>
</bean>
</array>
</property>
</bean>