mybatis
pagehelper
eclipse
首先在mybatis.cfg.xml文件中增加pagehelper插件配置:
配置spring、springmvc、mybatis集成配置文件:
在web.xml文件中进行spring与springmvc相关配置:
配置springmvc相关配置:
现在集成环境已经搭建好了,pagehelper的使用只要在控制层几行代码就可以了:package com.gwolf.crud.controller;@Controllerpublic class EmployeeController { @Autowired EmployeeService employeeService; @RequestMapping("/emps") public String getEmps(@RequestParam(value="pn",defaultValue="1") Integer pn,Model model) { PageHelper.startPage(pn, 5); List
新建一个jsp页面,分页查询员工信息:<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %><% pageContext.setAttribute("APP_PATH",request.getContextPath());%>
SSM-CRUD
# | empName | gender | department | 操作 |
---|