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. HDU 3666 THE MATRIX PROBLEM (差分约束)

    题意:给定一个最大400*400的矩阵,每次操作可以将某一行或某一列乘上一个数,问能否通过这样的操作使得矩阵内的每个数都在[L,R]的区间内. 析:再把题意说明白一点就是是否存在ai,bj,使得l&l ...

  2. JAVA 反射应用:properties2Object

    MixAll.java import java.lang.reflect.Method; import java.util.Properties; public class MixAll { /** ...

  3. C#中的where从句

    C#中的where从句 2011-07-03 13:07OrphousV | 分类:C#/.NET | 浏览8443次 能解释一下下面两段代码中where的作用吗?using System;publi ...

  4. maven常见问题归纳

    前言 Maven,发音是[`meivin],"专家"的意思.它是一个非常好的项目管理工具,非常早就进入了我的必备工具行列,可是这次为了把ABPM项目 全然迁移并应用maven,所以 ...

  5. iterm2相关配置

    使用 iterm2 登陆 公司堡垒机 进行 上传 下载文件 等维护操作.. 1.需要安装iterm2 软件 http://iterm2.com/  下载安装 2.安装brew ruby -e &quo ...

  6. Delphi 多文件拖放获取路径示例

    unit Unit1;interfaceuses  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, ...

  7. asp.net mvc控制器动作体返回ImageResult,可作验证码

    public ActionResult Img() { // 获取博客园空间顶部的banner图片 WebRequest req = WebRequest.Create("http://sp ...

  8. 解析“extern”

    解析“extern” 1. 声明外部变量 现代编译器一般採用按文件编译的方式,因此在编译时,各个文件里定义的全局变量是 互相透明的,也就是说,在编译时,全局变量的可见域限制在文件内部.以下举一个简单的 ...

  9. PHP泛域名应用

    以Windows开发环境 1.windows =>hosts文件 127.0.0.1    asia.t127.0.0.1    *.asia.t127.0.0.1    www.asia.t1 ...

  10. SSO-Javascript模拟IE登录,不让IIS弹出登录窗口

    解决方案:         用JS模拟IE用户登录,再跳转到对应的系统.   <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transiti ...