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. 通过克隆MAC地址 破解网通电信封路由

    通过克隆MAC地址 破解网通电信封路由 电信封路由方法一:先确定申请上网的电脑单机状态下已经能够上网.就说明该电脑网卡的MAC地址是合法的MAC地址.进入系统的MSDOS方式,发布ipconfig/a ...

  2. PostgreSQL的 initdb 源代码分析之七

    继续分析:由于我使用initdb的时候,没有指定 locale,所以会使用OS的缺省locale,这里是 en_US.UTF-8 printf(_("The files belonging ...

  3. Android Developers:在命令行构建和运行

    使用Ant构建脚本构建你的应用程序有两种方式:一种用于测试/调试你的引用程序—debug模式—另一种用于构建你最终发布的包-release模式.无论你使用哪种方式构建你的应用程序,它必须在安装在模拟器 ...

  4. 纯Javascript实现Windows 8 Metro风格实现

    Metro风格设计主要特点 1.Windows 8 Metro风格设计,实现网站或系统功能的导航 2.纯Javascript实现 3.支持所有IE.360.Chrome等常用浏览器 4.支持圆角.阴影 ...

  5. GitHub使用详解

    1.GitHub是什么? GitHub这个名词既可以是那个流行的代码分享和协作网站 https://github.com/,也可以是指Git客户端工具(与其他的Git客户端工具如GitEye类似,只不 ...

  6. ABAP FIELD-SYMBOLS 有大作用- 将没有可改参数的增强出口变得也能改主程序的值了

    看下图代码: report  z_xul_test2 中 定义了 全局变量 G_DATA1 , 分别调用了 z_xul_tes1 中的 form  和 function zbapi_test , 这两 ...

  7. HttpServer的使用

    http://docs.oracle.com/javase/8/docs/jre/api/net/httpserver/spec/overview-summary.html 1.Package com ...

  8. 搭建属于自己的wiki

    1.开源wiki mediawiki http://www.mediawiki.org/wiki/MediaWiki 2. 开发文档 http://www.mediawiki.org/wiki/Man ...

  9. win7引导项顺序

    转载:http://jingyan.baidu.com/article/72ee561aa1d123e16138df81.html 问题描述: 个人在宿舍使用的比较多的是Window 7,而它的启动项 ...

  10. 网口扫盲三:以太网芯片MAC和PHY的关系

    转载:http://www.cnblogs.com/jason-lu/articles/3195473.html   问:如何实现单片以太网微控制器? 答:诀窍是将微控制器.以太网媒体接入控制器(MA ...