1、首先引入easyui包,可以在官方网站下载,http://www.jeasyui.com/download/index.php

<link rel="stylesheet" type="text/css" href="easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="easyui/themes/icon.css">
<script type="text/javascript" src="js/jquery-easyui-1.3.2/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="js/jquery-easyui-1.3.2/jquery.easyui.min.js"></script>
<script type="text/javascript" src="js/jquery-easyui-1.3.2/locale/easyui-lang-zh_CN.js"></script>

注意:jquery-1.8.0.min.js要在jquery.easyui.min.js之前引入。

2、Create datagrid from an existing table element, defining columns, rows, and data in html.

<table id="dg"
title="社团基本信息"
class="easyui-datagrid"
style="width:1200px;height:600px;"
url="list"
pagination="true"
rownumbers="true"
fitColumns="true"
singleSelect="true">
<thead>
<tr>
<th field="stu_id" width="40">学号</th>
<th field="stu_name" width="50">姓名</th>
<th field="stu_yuanxi" width="50">院系</th>
<th field="stu_email" width="80">Email</th>
<th field="stu_phone" width="50">电话</th>
<th field="stu_qq" width="40">QQ</th>
<th field="stu_sex" width="20">性别</th>
<th field="stu_age" width="40">出生年月</th>
<th field="stu_join" width="40">参加时间</th>
<th field="depart_name" width="50">所在社团</th>
<th field="stu_job" width="50">职务</th>
<th field="stu_like" width="50">爱好</th>
</tr>
</thead>
</table>

3、表student对应的实体

public class Student {
private int id;
private String stu_id;
private String stu_name;
private String stu_password;
private String stu_yuanxi;
private String stu_job;
private String stu_email;
private String stu_phone;
private String stu_qq;
private String stu_sex;
private String stu_age;
private String depart_name;
private String role_name;
private int depart_id;
private int role_id;
private String stu_like;
private int u_id;
private String u_dept;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
......

4、DAO实现获取student记录

	public List<Student> listStudent(int pageNumber,int pageSize){

		List<Student> list=new ArrayList<Student>();
String sql="select * from student limit " + pageNumber+"," + pageSize ;
try {
list = runner.query(sql, new BeanListHandler<Student>(Student.class));
} catch (SQLException e) {
e.printStackTrace();
}
return list;
}

5、Servlet实现跳转,将数据返回给前台

public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//处理乱码
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html; charset=UTF-8");
int page;
try {
page = Integer.parseInt(request.getParameter("page"));
} catch (NumberFormatException e) {
page = 1;
}
int row;
try {
row = Integer.parseInt(request.getParameter("rows"));
} catch (NumberFormatException e) {
row = 10;
} PrintWriter out = response.getWriter(); //获得student列表
StudentInfoService studentInfoService = new StudentInfoService();
List<Student> list =studentInfoService.listStudent(page, row) ;
long total = studentInfoService.results() ; Map<String, Object> map = new HashMap<String, Object>();
map.put("total", total);
map.put("rows", list);
Gson gson = new Gson();
String json = gson.toJson(map);
out.write(json);
out.flush();
out.close();
}

6、前台效果图

jquery easyui datagrid 分页 详解(java)的更多相关文章

  1. jquery easyui datagrid 分页详解

    由于项目原因,用了jquery easyui 感觉界面不错,皮肤样式少点,可是官网最近打不开了,资料比较少,给的demo没有想要的效果,今天在用datagrid 做分页显示的时候,折腾了半天,网上的资 ...

  2. jquery easyui datagrid 分页 详解

    前些天用jquery easyui的table easyui-datagrid做分页显示的时候,折腾了很久,后来终于解决了.其实不难,最主要我不是很熟悉前端的东西. table easyui-data ...

  3. easyui datagrid 分页略解

    easyui datagrid 本身自带了分页功能. 但是这个需要你自己控制. 在后台可以得到两个datagrid的参数,rows 和page.其中rows是每页要显示的个数,page是第几页.单纯的 ...

  4. jquery easyui datagrid 分页实现---善良公社项目

    接着上篇文章,接下来给大家分享分页的实现,分页其实多多少少见过很有几种,框架中带的图片都特别的好看,会给用户以好的使用效果,具体实现,需要自己来补充代码: 图示1: 通常情况下页面数据的分页显示分成真 ...

  5. jquery easyui datagrid 分页实现

    通常情况下页面数据的分页显示分成真假两种.真分页是依靠后台查询时控制调出数据的数量来实现分页,也就是说页面在后台对数据进行处理,仅传输当前需要页的数据到前台来显示.而假分页则是后台一次性将所有的数据一 ...

  6. JQuery easyui Datagrid 分页事件

    easyui是Jquery中的一个轻量级UI插件,提供了一些诸如window.datagrid.button等控件.现在主要说说Datagrid中分页控件的使用. easyui中可以单独添加分页pag ...

  7. jQuery EasyUI datagrid实现本地分页的方法

    http://www.codeweblog.com/jquery-easyui-datagrid%e5%ae%9e%e7%8e%b0%e6%9c%ac%e5%9c%b0%e5%88%86%e9%a1% ...

  8. jQuery Validate验证框架详解

    转自:http://www.cnblogs.com/linjiqin/p/3431835.html jQuery校验官网地址:http://bassistance.de/jquery-plugins/ ...

  9. jquery easyui datagrid使用参考

    jquery easyui datagrid使用参考   创建datagrid 在页面上添加一个div或table标签,然后用jquery获取这个标签,并初始化一个datagrid.代码如下: 页面上 ...

随机推荐

  1. Listener 监听器

    Listener的定义与作用 监听器Listener就是在application,session,request三个对象创建.销毁或者往其中添加修改删除属性时自动执行代码的功能组件. Listener ...

  2. javabean总结

    一. javabean 是什么? Bean的中文含义是“豆子”,顾名思义,JavaBean是指一段特殊的Java类, 就是有默然构造方法,只有get,set的方法的java类的对象. 专业点解释是: ...

  3. ORA-01033: ORACLE initialization or shutdown in progress 实用的处理方法

    ORA-01033: ORACLE initialization or shutdown in progress 实用的处理方法,此问题通常是由于电脑非正常关机造成的,我们可以用下面的方法查找出是那个 ...

  4. .NET Reflector插件FileDisassembler还原源码

    NET Reflector,它是一个类浏览器和反编译器,可以分析程序集并向您展示它的所有秘密..NET 框架向全世界引入了可用来分析任何基于 .NET 的代码(无论它是单个类还是完整的程序集)的反射概 ...

  5. arcmap+vs2010

    esri为vs2010提供了addin开发模版,有几个关键的地方注意下 1.C:\Program Files (x86)\MSBuild\Esri\下存在ESRI.ArcGIS.AddIns.Serv ...

  6. android ipc通信机制之之三,进程通讯方式。

    IPC通讯方式的优缺点: IPC通讯方式的对比 名称 优点 缺点 适用场景 Bundle 简单易用 只能传输Bundle支持的数据类型 四大组件的进程通信 文件共享 简单易用 不适合高并发场景,并无法 ...

  7. osg 笔记一 (转)

    场景图形采用一种自顶向下的,分层的树状数据结构来组织空间数据集,以提高渲染的效率 场景图形树结构的顶部是一个根节点,从根节点向下延伸,各个组节点中均包含了几何信息和用于控制其外观的渲染状态信息.根节点 ...

  8. delphi TPopupMenu.Popup

      procedure TPopupMenu.Popup(X, Y: Integer);     这个点是相对桌面的而不是窗体的   GetCursorPos是鼠标的位置 鼠标动这个点就不一样   v ...

  9. exe文件当前目录搜索文件

    方法: //std::string dir = "C:\\Users\\xzd\\Documents\\KinectFile\\2014-09-07\\Select\\mengyue\\&q ...

  10. C语言中堆和栈的区别

    原文:http://blog.csdn.net/tigerjibo/article/details/7423728 C语言中堆和栈的区别 一.前言: C语言程序经过编译连接后形成编译.连接后形成的二进 ...