码迷,mamicode.com
首页 > 其他好文 > 详细

struts2 、mybatis 、easyui 分页

时间:2016-08-06 08:15:33      阅读:258      评论:0      收藏:0      [点我收藏+]

标签:

rows

page

 

控件自动提交这两个参数

pageSize number The page size. 10
pageNumber number Show the page number when pagination is created. 1
pageList array User can change the page size. The pageList property defines how many size can be changed. [10,20,50,100]

 

action

    /**
     * easyui获取APP信息
     * */
    public String getAppList() {
        dataMap = appService.getApp(rows, page);
        return "json";
    }

    public String getRows() {
        return rows;
    }

    public void setRows(String rows) {
        this.rows = rows;
    }

    public String getPage() {
        return page;
    }

    public void setPage(String page) {
        this.page = page;
    }

    public Map<String, Object> getDataMap() {
        return dataMap;
    }

    public void setDataMap(Map<String, Object> dataMap) {
        this.dataMap = dataMap;
    }

serviceImpl

    public Map<String, Object> getApp(String rows, String page) {
        // 分页信息
        int pageNo = Integer.parseInt((page == null || page == "0") ? "1" : page);
        int pageSize = Integer.parseInt((rows == null || rows == "0") ? "10" : rows);
        
        Map<String, Object> dataMap = new HashMap<String, Object>();
        dataMap.put("total",appMapper.countByExample(null));
        dataMap.put("rows", appMapper.selectByExample(
                null, new RowBounds((pageNo - 1) * pageSize,pageSize)));
        //org.apache.ibatis.session.RowBounds.RowBounds(int offset, int limit)
        return dataMap;
    }

 

struts2 、mybatis 、easyui 分页

标签:

原文地址:http://www.cnblogs.com/zno2/p/4536382.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!