1.maven依赖

<dependency>
<groupId>com.github.jsqlparser</groupId>
<artifactId>jsqlparser</artifactId>
<version>3.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.github.pagehelper/pagehelper -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.1.10</version>
</dependency>

2.mybatis.xml( 关于pagehelper    https://pagehelper.github.io/docs/)

<plugins>
<plugin interceptor="com.github.pagehelper.PageInterceptor">
<!-- config params as the following -->
<property name="helperDialect" value="mysql"/>
</plugin>
</plugins>

3.Controller

@Controller
public class StudentController { @Autowired
private StuServiceImpl stuService; @ResponseBody
@RequestMapping("/all")
public PageInfo<Stu_info> list(int currentPage, int pageSize) {
return stuService.getAllStu(currentPage,pageSize);
}
}

4.service和实现类

接口:

public interface StuService {
public PageInfo<Stu_info> getAllStu(int currentPage, int pageSize);
} impl: @Service
public class StuServiceImpl implements StuService { @Autowired
private Stu_infoMapper stu_infoMapper; @Override
public PageInfo<Stu_info> getAllStu(int currentPage, int pageSize) { PageHelper.startPage(currentPage,pageSize); List<Stu_info> stuInfoList =stu_infoMapper.AllStu(); PageInfo pageInfo = new PageInfo(stuInfoList); return pageInfo;
}
}

5.dao和mapper

public List<Stu_info> AllStu();

  

 <select id="AllStu" resultMap="BaseResultMap">

           select  * from  stu_info ORDER BY id

  </select>

6.网址输入

http://localhost:8080/all?currentPage=2&pageSize=3

SSM+pagehelper分页的更多相关文章

  1. PageHelper分页实战(SSM整合)

    步骤一:引入SSM相关的jar包,包列表如下: 步骤二:创建或修改配置文件,配置文件清单如下: applicationContext.xml <?xml version="1.0&qu ...

  2. PageHelper分页插件的使用

    大家好!今天写ssm项目实现分页的时候用到pageHelper分页插件,在使用过程中出现了一些错误,因此写篇随笔记录下整个过程 1.背景:在项目的开发的过程中,为了实现所有的功能. 2.目标:实现分页 ...

  3. 17-SSM中通过pagehelper分页的实现

    SSM中通过pagehelper分页的实现 1. 在SSM框架的基础上实现,导包 <!-- 分页 --> <dependency> <groupId>com.git ...

  4. 如何在实际项目中使用PageHelper分页插件

    PageHelper是一个分页插件,能够简单快速的帮助开发人员完成常见的分页功能,你只需要简单的使用两行代码就可以完成一个分页效果- 最近做一个科创项目,使用Maven+SSM的环境,有分页的功能,于 ...

  5. 扩展-PageHelper分页插件

    1.PageHelper 分页插件简介 1) PageHelper是MyBatis中非常方便的第三方分页插件 2) 官方文档: https://github.com/pagehelper/Mybati ...

  6. 基于SSM的分页

    现在基本每一个项目都有用到分页,SSM也是当前企业用到的比较频繁的框架,这里我就总结一下基于SSM的分页: 一.首先我们要准备一个分页的工具类 /** * 分页 */ public class Pag ...

  7. Springboot 系列(十二)使用 Mybatis 集成 pagehelper 分页插件和 mapper 插件

    前言 在 Springboot 系列文章第十一篇里(使用 Mybatis(自动生成插件) 访问数据库),实验了 Springboot 结合 Mybatis 以及 Mybatis-generator 生 ...

  8. SpringBoot整合系列-PageHelper分页插件

    原创作品,可以转载,但是请标注出处地址:https://www.cnblogs.com/V1haoge/p/9971043.html SpringBoot整合MyBatis分页插件PageHelper ...

  9. SpringBoot+Mybatis配置Pagehelper分页插件实现自动分页

    SpringBoot+Mybatis配置Pagehelper分页插件实现自动分页 **SpringBoot+Mybatis使用Pagehelper分页插件自动分页,非常好用,不用在自己去计算和组装了. ...

随机推荐

  1. c++问题集合

    1.对于程序未运行和运行后的代码段到底存储什么? 2.编写程序时为什么先申请变量后使用? 3.malloc本质到底分配了什么?谁赋给的? 4.程序在系统上是怎么运行起来的? 5.当我们双击一个程序运行 ...

  2. Flask-第三方插件

    Flask-Session 因为flask自带的session是将session存在cookie中: 所以才有了第三方Flask_session插件,可以将session存储在我们想存储的数据库中(r ...

  3. elasticsearch java动态设置mapping并指定分词器

    //创建索引 client.admin().indices().prepareCreate("twitter").execute().actionGet(); //配置mappin ...

  4. git clone速度太慢解决方案

    原文地址:https://blog.csdn.net/hzwwpgmwy/article/details/79043251 适用各种操作系统,本次测试于ubuntu,下载速度从二十几k提高到二百多k ...

  5. Understanding the ASP.NET MVC Execution Process

    https://docs.microsoft.com/en-us/aspnet/mvc/overview/older-versions-1/overview/understanding-the-asp ...

  6. 关于Java 8新引入语法特性的简要说明

    Java 8在语法上的主要改进就是新增了Lambda Expression以及Method Reference.由于官方网站的介绍稍显罗嗦,而且例子也有些复杂.我这里将提供一些更为浅显.直观的例子来帮 ...

  7. Response.setContentType()参数说明

    response.setContentType()的参数说明 <meta http-equiv="Content-Type" content="text/html; ...

  8. 如何设置payjs的微信jsapi支付目录

    首先你得是 payjs 的有效开通用户.不清楚 payjs 是干什么的可以自行百度. 设置方法非常简单,在后台菜单-系统设置-JSAPI目录设置,在右侧填写支付目录即可. 需要注意的是:支付目录需要配 ...

  9. jmeter5实现文件上传接口测试

    背景:在公司做接口自动化编写过程中,遇到需要测试一个在线下载导入模板的接口,之前都没有接触过关于文件上传下载的接口测试,此处做个记录,为后续工作开展做个参考. 步骤: 打开浏览器按F12 手动进行文件 ...

  10. IDEA配置Hystrix过程中报错: java.lang.IllegalStateException: No instances available for user-service

    最近在练习微服务架构中, 使用IDEA配置完Hystrix, 添加熔断方法后, 在浏览器中访问未启动的( 含有熔断方法注解 )的路径时, 报出了 : 500: No instances availab ...