环境准备

  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. python 学习笔记十九 django深入学习四 cookie,session

    缓存 一个动态网站的基本权衡点就是,它是动态的. 每次用户请求一个页面,Web服务器将进行所有涵盖数据库查询到模版渲染到业务逻辑的请求,用来创建浏览者需要的页面.当程序访问量大时,耗时必然会更加明显, ...

  2. Tomcat崩溃

    参考: http://bbs.csdn.net/topics/390391810?page=1 自己遇到的: --------------------------------------------- ...

  3. AfxBeginThread中使用updatedata出错

    原因:MFC对象不支持多线程操作,不能供多个线程进程使用,所以尽量不要在线程里面更新界面. 解决办法: 1.将工程改为release 2.使用控件来SetWindowText 3.在线程里面发送消息 ...

  4. iOS利用通知逆传值

    直接创建两个控制器,点击跳转第二个界面,然后点击按钮进行传值 #import "ViewController.h" #import "TWOOViewController ...

  5. 轻松解决U盘中病毒,文件变成.exe执行文件的问题

    U盘中的文件都变成.exe可执行文件是怎么回事?告诉你,你的U盘中病毒了,那么如何清除呢?小编现在就告诉你几个简单方法,轻松就能搞定U盘中病毒问题. 方法1: (1)首先使用杀毒软件把U盘杀杀毒,除去 ...

  6. python基础编程

    1.if else var1 = 100 if var1: print ("1 - if 表达式条件为 true") print (var1) #为0时,条件不成立 var2 = ...

  7. 小谈一下JavaScript中的JSON

    一.JSON的语法可以表示以下三种类型的值: 1.简单值:字符串,数值,布尔值,null 比如:5,"你好",false,null JSON中字符串必须用双引号,而JS中则没有强制 ...

  8. Mac安装ctags

    Mac安装ctags mac 系统有自带的ctags,但是不支持"ctags -R"指令,需要自己在安装Exuberant Ctags 1.下载ctags 2. 安装 ./conf ...

  9. jq异步上传文件(转载)

    最近在使用ajaxForm,随便把使用方法记下下来,以便以后回顾. 1 ,引入依赖脚本 <script type="text/JavaScript" src="/j ...

  10. ApplicationContextAware 接口

    一.这个接口有什么用? 当一个类实现了这个接口(ApplicationContextAware)之后,这个类就可以方便获得ApplicationContext中的所有bean.换句话说,就是这个类可以 ...