环境准备

  1.dataTables

    下载:http://download.csdn.net/detail/marskuroky/8173839

  2.jsonObject

    下载:http://download.csdn.net/detail/marskuroky/8173831

前台代码

  只是简单测试,把bean放在了session中,方便提取

<jsp:useBean id="userInfo" class="XXX.UserInfoSessionBean" scope="session"></jsp:useBean>

  dataTables代码展开,放到相应的路径(我的/WEB-INF/JS/)

  jsp代码

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="XXX.Const"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<jsp:useBean id="userInfo" class="XXX.UserInfoSessionBean" scope="session"></jsp:useBean>
<%
String basePath = request.getContextPath() + "/";
%>
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<link href="<%=basePath%>js/DataTables/media/css/jquery.dataTables.min.css" rel="stylesheet" type="text/css" media="screen" />
<link href="<%=basePath%>js/DataTables/media/css/jquery.dataTables.css" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript" src="<%=basePath%>js/DataTables/media/js/jquery.js"></script>
<script type="text/javascript" src="<%=basePath%>js/DataTables/media/js/jquery.dataTables.js"></script> <style type="text/css">
.borRed{
color:red;
}
</style>
<script type="text/javascript" language="javascript"> var tmail = <%=userInfo.getMailAddr()%>
alert(tmail[].adOwnId);
$(document).ready(function() {
//$('#demo').html( '<table cellpadding="0" cellspacing="0" border="0" class="display" id="example"></table>' );
alert();
$("#example").dataTable({
"aaData": tmail,
"aoColumns": [
{ "mDataProp": "selectedRateUsd" },
{ "mDataProp": "selectedRateJpy" },
{ "mDataProp": "adOwnId" },
{ "mDataProp": "connDbId" },
]
} );
});
</script>
<title>Insert title here</title>
</head>
<body>
<div id="contents">
<table id="example">
<thead>
<tr>
<th>test1</th>
<th>test2</th>
<th>test3</th>
<th>test4</th>
</tr>
</thead>
<tbody> </tbody>
</table>
</div>
</body>
</html>

  后台代码

List<UserInfoSessionBean> list = new ArrayList<UserInfoSessionBean>();
UserInfoSessionBean bean1 = new UserInfoSessionBean();
bean1.setAdOwnId();
bean1.setConnDbId("");
list.add(bean1);
UserInfoSessionBean bean2 = new UserInfoSessionBean();
bean2.setAdOwnId();
bean2.setConnDbId("");
list.add(bean2);
JSONArray json = JSONArray.fromObject(list);
// userInfo是准备存在session中的bean
userInfo.setMailAddr(json.toString());

  

jquery_datatables的更多相关文章

随机推荐

  1. tomcat源码分析(一)从tomcat架构说起

    p { margin-bottom: 0.25cm; line-height: 120% }

  2. 5.对与表与表之间的关系,efcore是如何处理的

    public class Account { [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Accoun ...

  3. memcached安装

    memcached安装 一.安装gcc # yum -y install gcc 二.安装libevent # wget http://www.monkey.org/~provos/libevent- ...

  4. php-sql-parser sql防注入脚本

    <?php /** * SQL Parser from: http://code.google.com/p/php-sql-parser/ * License: New BSD */ class ...

  5. php : 常用函数

    常用函数: <?php /** * 获取客户端IP * @return [string] [description] */ function getClientIp() { $ip = NULL ...

  6. Hbase的配置和安装

    Hbase的配置和安装 1. 解压hbase.配置HBASE_HOME tar -zxvf hbase-1.2.4.tar.gz 2. 修改$HBASE_HOME/conf/hbase-env.sh文 ...

  7. 集​群​t​o​m​c​a​t​+​a​p​a​c​h​e​配​置​文​档

    http://wenku.baidu.com/link?url=M_Lt07e-9KTIHucYgJUCNSxkjWThUuQ2P8axn8q6YmY_yQw7NmijQoDA2wKmi_FQUxwO ...

  8. hdu4449Building Design(三维凸包+平面旋转)

    链接 看了几小时也没看懂代码表示的何意..无奈下来问问考研舍友. 还是考研舍友比较靠谱,分分钟解决了我的疑问. 可能三维的东西在纸面上真的不好表示,网上没有形象的题解,只有简单"明了&quo ...

  9. JavaScript中关于地址的获取

    //取当前页面名称(不带后缀名) function pageName(){ var a = location.href; var b = a.split("/"); var c = ...

  10. 后台启动weblogic成功后,在web浏览器上无法访问

    后台启动weblogic成功后,在web浏览器上无法访问,可尝试重启服务器.