SpringMVC+EASYUI实现分页
来源:互联网 发布:杨中科c语言也能干大事 编辑:程序博客网 时间:2024/06/06 01:05
Controller
@RequestMapping("userList") @ResponseBody public Map<String, Object> getAll(HttpServletRequest request){ int currentPage=Integer.parseInt(request.getParameter("page")); int pageSize=Integer.parseInt(request.getParameter("rows")); int total = userService.getAllRecord();List<User> list =userService.getAllUser(currentPage,pageSize); Map<String, Object> map=new HashMap<String,Object>(); map.put("total", total); map.put("rows", list); return map; } @RequestMapping("goMymain") public String go(){ return "main"; }
Service@Overridepublic List<User> getAllUser(int currentPage, int pageSize) {Map<Object,Object> map = new HashMap<>();map.put("currentPage",(currentPage-1)*pageSize );map.put("pageSize", pageSize);return userMapper.getAllUser(map);}
Mapper<select id="getAllRecord" resultType="int">select count(*) from user </select><select id="getAllUser" resultType="com.wlc.pojo.User" parameterType="map"> select * from user limit #{currentPage},#{pageSize} </select>页面
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>用户信息列表</title> <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/default/easyui.css"> <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/icon.css"> <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/color.css"> <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/demo/demo.css"> <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.min.js"></script> <script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script></head><body> <h2>用户信息列表</h2> <p>You can add User,or Edit_User、Delete_User if you selected an user</p> <table id="dg" title="用户操作" class="easyui-datagrid" style="width:700px;height:250px" url="<%=request.getContextPath()%>/userList" toolbar="#toolbar" pagination="true" rownumbers="true" fitColumns="true" singleSelect="true"> <thead> <tr> <th field="id" width="30" >用户ID</th> <th field="name" width="50">姓名</th> <th field="password" width="30">密码</th> </tr> </thead> </table> <div id="dlg" class="easyui-dialog" style="width:400px;height:280px;padding:10px 20px" closed="true" buttons="#dlg-buttons"> <div class="ftitle">用户信息</div> <form id="fm" method="post" novalidate> <div class="fitem"> <label>用户ID:</label> <input name="id" class="easyui-textbox" required="true" > </div> <div class="fitem"> <label>姓名:</label> <input name="name" class="easyui-textbox" required="true"> </div> <div class="fitem"> <label>密码:</label> <input name="password" type="password" class="easyui-textbox" required="true"> </div> </form> </div></body></html>==========================================================================================================================================================页面二使用datagrid<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>用户信息列表</title> <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/default/easyui.css"> <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/icon.css"> <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/color.css"> <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/demo/demo.css"> <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.min.js"></script> <script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script> <script type="text/javascript"> $(function() { $('#mydatagrid').datagrid({ title : 'datagrid实例', iconCls : 'icon-ok', width : 600, pageSize : 5,//默认选择的分页是每页5行数据 pageList : [ 5, 10, 15, 20 ],//可以选择的分页集合 nowrap : true,//设置为true,当数据长度超出列宽时将会自动截取 striped : true,//设置为true将交替显示行背景。 collapsible : true,//显示可折叠按钮 toolbar:"#tb",//在添加 增添、删除、修改操作的按钮要用到这个 url:'userList',//url调用Action方法 loadMsg : '数据装载中......', singleSelect:true,//为true时只能选择单行 fitColumns:true,//允许表格自动缩放,以适应父容器 //sortName : 'xh',//当数据表格初始化时以哪一列来排序 //sortOrder : 'desc',//定义排序顺序,可以是'asc'或者'desc'(正序或者倒序)。 remoteSort : false, frozenColumns : [ [ { field : 'ck', checkbox : true } ] ], pagination : true,//分页 rownumbers : true//行数 }); }); </script> </head><body> <h2> <b>easyui的DataGrid实例</b> </h2> <table id="mydatagrid"> <thead> <tr> <th data-options="field:'id',width:100,align:'center'">学号</th> <th data-options="field:'name',width:100,align:'center'">姓名</th> <th data-options="field:'password',width:100,align:'center'">密码</th> </tr> </thead> </table> </body></html>
阅读全文
0 0
- SpringMVC+EASYUI实现分页
- MyBatis+springMVC+easyUI (dataGirl)实现分页
- springmvc + jquery easyui实现分页显示
- SpringMVC+easyUI中datagrid分页实现(转载)
- springmvc+mybatis+easyui分页
- springmvc+mybatis+easyui分页
- MyBatis+springMVC+easyUI (dataGirl)实现分页(转载)
- Spring+SpringMVC+MyBatis+EasyUI实现CRUD与分页
- SpringMVC+JPA+EasyUI 服务端分页
- springMVC+easyui中的datagrid分页
- easyui分页的实现
- jquery easyui分页实现
- easyui 分页实现
- easyui实现分页
- mybatis+easyUI实现分页
- EasyUI实现分页查询
- 【MyBatis】MyBatis+SpringMVC+EasyUI整合分页
- springmvc+easyUI的DataGrid分页功能
- JSP学习心得-程序员技术浅谈
- oracle11g本地可以访问但局域网无法访问
- ArcEngine打开数据源(FeatureClass)
- 第一次写
- python知识备忘集合(持续更新)
- SpringMVC+EASYUI实现分页
- A Beginner Tutorial for Writing Simple COM/ATL DLL For VS2012
- 解决ubuntu下boot空间不足的问题
- CAS单点登录小技巧
- [Java配置]JDK安装与环境变量配置
- PHP-设计模式-依赖注入
- javascript基本数据类型和typeof
- 10进制转36进制
- kotlin实现Android实现底部对话框BottomDialog(圆角,直角)