SSM-CRUD
一、项目介绍 前端技术:query+Bootstrap+ajax+json 后端技术:SSM(spring、springMVC、mybatis)、JSR303校验 数据库:mysql 服务器:tomcat9.0 项目内容:对员工和部门进行增删改查操作、用pageHelper插件实现分页功能、全选/全不选等。 二、遇到的问题和解决方法 1、用pageHelper插件实现分页,pageSize=集合长度(pagehelper插件失效) pageInfo源码中: 1 if (list instanceof Collection) { 2 this.pageNum = 1; 3 this.pageSize = list.size(); 4 this.pages = this.pageSize > 0 ? 1 : 0; 5 this.size = list.size(); 6 this.startRow = 0; 7 this.endRow = list.size() > 0 ? list.size() - 1 : 0; 8 } 错误原因:pagehelper除了添加依赖,还需要在mybatis-config.xml中配置中添加拦截器PageInterceptor 1 <!-- https://mvnrepository.com/artifact/com.github.pagehelper