页面展示效果。

页面代码:

  1. <%@ page contentType="text/html;charset=UTF-8" language="java" %>
  2. <%@include file="/common/common.jsp" %>
  3. <html>
  4. <head>
  5. <title></title>
  6. </head>
  7. <body>
  8. <h2>样片库管理</h2>
  9. <div style="padding:8px;height:auto">
  10. 参数项名称: <input class="easyui-validatebox" type="text" name="name" data-options="required:true">
  11. 创建时间: <input class="easyui-datebox" name="createTime" style="width:80px">
  12. <a href="#" class="easyui-linkbutton" iconCls="icon-search">查找</a>
  13. <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add'">添加</a>
  14. </div>
  15. <table id="tt" class="easyui-datagrid" style="width:910px;height:350px"
  16. title="参数项列表" iconCls="icon-save"
  17. rownumbers="false" pagination="true">
  18. </table>
  19. <script type="text/javascript">
  20. $('#tt').datagrid({
  21. title: "参数项列表",
  22. url: '/getAllParam',
  23. pageSize:5,
  24. columns: [
  25. [
  26. {field: 'paramId', title: '参数ID', width: 180, align: "center"},
  27. {field: 'paramName', title: '参数名称', width: 180, align: "center"},
  28. {field: 'paramLabel', title: '标签', width: 180, align: 'center'},
  29. {field: 'createTime', title: '创建时间', width: 180, align: "center"}
  30. ]
  31. ], toolbar: [
  32. {
  33. text: '添加',
  34. iconCls: 'icon-add',
  35. handler: function () {
  36. openDialog("add_dialog", "add");
  37. }
  38. },
  39. '-',
  40. {
  41. text: '修改',
  42. iconCls: 'icon-edit',
  43. handler: function () {
  44. openDialog("add_dialog", "edit");
  45. }
  46. },
  47. '-',
  48. {
  49. text: '删除',
  50. iconCls: 'icon-remove',
  51. handler: function () {
  52. delAppInfo();
  53. }
  54. }
  55. ]
  56. });
  57. //设置分页控件
  58. var p = $('#tt').datagrid('getPager');
  59. p.pagination({
  60. pageSize: 5,//每页显示的记录条数,默认为10
  61. pageList: [5, 10, 15],//可以设置每页记录条数的列表
  62. beforePageText: '第',//页数文本框前显示的汉字
  63. afterPageText: '页    共 {pages} 页',
  64. displayMsg: '当前显示 {from} - {to} 条记录   共 {total} 条记录'
  65. });
  66. </script>
  67. </body>
  68. </html>

mapper.xml

  1. <!-- 分页查询-->
  2. <select id="selectAllPage" resultMap="BaseResultMap" parameterType="java.util.Map" >
  3. select
  4. <include refid="Base_Column_List"/>
  5. from param_item
  6. <include refid="Example_Where_Clause"/>
  7. limit #{pageIndex},#{pageSize}
  8. </select>

controller方法

    1. @RequestMapping(value = "getAllParam")
    2. public void getAllParam(HttpServletRequest request, HttpServletResponse response,
    3. @RequestParam(required = false, defaultValue = "1") Integer page, //第几页
    4. @RequestParam(required = false, defaultValue = "10") Integer rows, //页数大小
    5. @RequestParam(required = false, defaultValue = "") String paramName,
    6. @RequestParam(required = false, defaultValue = "") String createTime
    7. ) throws IOException {
    8. JSONObject params = new JSONObject();
    9. params.put("pageSize", rows);
    10. params.put("pageIndex", (page-1)*rows);
    11. if (StringUtil.notEmpty(paramName)) {
    12. params.put("paramName", paramName);
    13. }
    14. if (StringUtil.notEmpty(createTime)) {
    15. }
    16. List list = paramItemService.getAllItemPage(params);
    17. JSONObject result = new JSONObject();
    18. result.put("rows", list);
    19. result.put("total", 11);
    20. ResponseUtil.sendJsonNoCache(response, result.toJSONString());
    21. }

MyBatis+springMVC+easyUI (dataGirl)实现分页的更多相关文章

  1. SSM后台管理系统(Spring SpringMVC Mybatis Mysql EasyUI)

    非常简单的一个后台管理系统,功能不多,框架也不复杂, 源码下载(附数据库)-ssm后台管理系统框架(Spring mvc + mybatis + mysql + easyui ) 实例图片

  2. Spring+Mybatis+SpringMVC后台与前台分页展示实例(附工程)(转)

    林炳文Evankaka原创作品.转载请注明出处http://blog.csdn.net/evankaka 摘要:本文实现了一个后台由Spring+Mybatis+SpringMVC组成,分页采用Pag ...

  3. Spring+Mybatis+SpringMVC后台与前台分页展示实例(附工程)

    林炳文Evankaka原创作品.转载请注明出处http://blog.csdn.net/evankaka 摘要:本文实现了一个后台由Spring+Mybatis+SpringMVC组成,分页采用Pag ...

  4. Spring+Mybatis+SpringMVC后台与前台分页展示实例

    摘要:本文实现了一个后台由spring+Mybatis+SpringMVC组成,分页采用PageHelper,前台展示使用bootstrap-paginator来显示效果的分页实例.整个项目由mave ...

  5. 【原】EasyUI ComboGrid 集成分页、按键示例

    需求: 1.下拉框下拉时出现表格: 2.表格带分页功能: 3.可以使用向上键.向下键在表格中移动选择行数据: 4.可以使用回车键在表格中选中行数据: 5.在下拉框的文本框中输入内容,能查询表格: 6. ...

  6. maven SpringMVC easyUI项目创建

    在Eclipse中使用Maven创建SpringMVC项目,项目所需软件及工具可以在官网下载.Maven.Nexus及Eclipse集成Maven等到此配置完毕. 1.Maven创建Web项目. 打开 ...

  7. EasyUI的datagrid分页

    EasyUI的datagrid分页 前台代码: <script type="text/javascript"> $(function () { //查询 search( ...

  8. Spring+Mybatis+SpringMVC+Maven+MySql搭建实例

    林炳文Evankaka原创作品.转载请注明出处http://blog.csdn.net/evankaka 摘要:本文主要讲了如何使用Maven来搭建Spring+Mybatis+SpringMVC+M ...

  9. easy-ui treegrid 实现分页 并且添加自定义checkbox

    首先第一点easy-ui  treegrid 对分页没有好的实现, 因为在分页的过程中是按照 根节点来分页的  后台只能先按照 根节点做分页查询  再将子节点关联进去, 这样才能将treegrid 按 ...

随机推荐

  1. Codeigniter:如何写一个好的Model

    本文是关于在Code Igniter PHP MVC框架中如何编写Model方法. CRUD 方法 CRUD 是Create, Retrieve, Update, and Delete的缩写. 这些是 ...

  2. jquery easy ui 1.3.4 窗口,对话框,提示框(5)

    5.1.window(窗口) 窗口我们在程序中会大量的使用,比如我们的添加.编辑都可以使用窗口实现,与winform的程序非常的类似.下面的代码是创建一个基本的窗口 $(function () { $ ...

  3. Android 开发 --Unable to resolve target 'android-19'

    Android 开发 --Unable to resolve target 'android-19' http://blog.csdn.net/love_javc_you/article/detail ...

  4. vijos 1028 LIS *

    链接:点我 #include<cstdio> #include<iostream> #include<algorithm> #include<cstring& ...

  5. mysql的多表查询

    转自:http://huaxia524151.iteye.com/blog/1423614 转自:http://blog.sina.com.cn/s/blog_4c197d420101cnm9.htm ...

  6. acm常用术语

    OJ是Online Judge系统的简称,用来在线检测程序源代码的正确性. Accepted (AC) : OK! Your program is correct! Presentation Erro ...

  7. PUSHA/PUSHAD

    http://124.16.151.186/docs/optimization/VTune(TM) User's Guide/mergedProjects/analyzer_ec/mergedProj ...

  8. java实例--海盗的最优方案

    package unit4; public class Pirate{ private String name; private int[] schemes; private int index; p ...

  9. LightOJ1013 Love Calculator(DP)

    容易猜测到包含s1.s2序列的串的最短长度是LCS(s1,s2) + ( len(s1) - LCS(s1,s2) ) + ( len(s2) - LCS(s1,s2) ) ,即: len(s1)+l ...

  10. 折线分割平面[HDU2050]

    折线分割平面 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Subm ...