bootstraptable实现前端分页和后端分页简单使用。

添加头文件









    /**
     * bootstrap前端分页
     * @return
     */
    @RequestMapping(value = "/bootTableClientGetAll")
    @ResponseBody
    public  List> bootTableGetAll(){
        List> all = cityDao.getAll();
        return all;
    }

 

 

// url: '/bootTableClientGetAll',
// sidePagination: 'client',

 

  /**
     * bootstrap后端分页
     */
    @RequestMapping(value = "/bootstrapServerGetAll")
    @ResponseBody
    public    Map bootstrapServerGetAll(HttpServletRequest request){
        System.out.println("-------------------------------");
        Map parameterMap = request.getParameterMap();
        MapparamterNewMap=new HashMap<>();
        for (Map.Entry entry : parameterMap.entrySet()) {
            System.out.println(entry.getKey() + "-------------" + entry.getValue()[0]);
            paramterNewMap.put(entry.getKey(),entry.getValue()[0]);
        }
        Integer pageNum=Integer.parseInt(request.getParameter("pageNum"));
        Integer pageSize=Integer.parseInt(request.getParameter("pageSize"));
        PageHelper.startPage(pageNum,pageSize);
//        List> all = cityDao.getAll();
        List> all = cityDao.getAll();
        PageInfo info=new PageInfo(all);
        MapresultMap=new HashMap<>();
        resultMap.put("total",info.getTotal());
        resultMap.put("data",info.getList());
        return resultMap;
    }

 

url: '/bootstrapServerGetAll',//后端分页的路径
sidePagination: 'server',//可选server,或者client

 

简单的业务逻辑可以直接前端分页,那个查询特别好,各个字段模糊查询连接一起了 。有兴趣可以研究。

 

全部代码:

<%--
  Created by IntelliJ IDEA.
  User: lhl
  Date: 2020/3/17
  Time: 9:16
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>


    Title
    
    
    
    


    
    
    




 

你可能感兴趣的:(bootstraptable实现前端分页和后端分页简单使用。)