控制层

作者: 打死你的小白兔 | 来源:发表于2018-04-12 16:33 被阅读0次
@RequestMapping("list")
    // 如果访问此访问:则路径为:user/list.do
    public String list(HttpServletRequest request) {
        String page = request.getParameter("currentPage") == null ? "1"
                : request.getParameter("currentPage");
        String queryname = request.getParameter("queryname") == null ? ""
                : request.getParameter("queryname");
        String querymoney = (request.getParameter("querymoney") == null || request
                .getParameter("querymoney") == "") ? "0" : request
                .getParameter("querymoney");
        float money = Float.parseFloat(querymoney);
        int currentPage = Integer.parseInt(page);
        Map<String,Object> map=new HashMap<String, Object>();
        map.put("name", queryname);
        map.put("money", money);
        map.put("start", (currentPage-1)* PageSize.PAGESIZE);
        map.put("end", PageSize.PAGESIZE);
        List<User> listPage = db.listPage(map);
        request.setAttribute("list", listPage);// 存起来
        int dataCount = (int) db.getUserCount(map);
        PageUtils.page(request, currentPage, PageSize.PAGESIZE, listPage,
                dataCount);
        return "list";
    }

相关文章

网友评论

      本文标题:控制层

      本文链接:https://www.haomeiwen.com/subject/cvqacftx.html