jquery_datatables
环境准备
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的更多相关文章
随机推荐
- Win10 Hyper-V 配置
Win10 Hyper-V 配置 安装 Hyper 程序和功能 -> 启用和关闭windows -> Hyper-V Hyper-V 虚拟网类型 外部网络 [外网/物理机/虚拟机] 内部网 ...
- jquery学习方法
http://www.runoob.com/jquery/jquery-tutorial.html jQuery 语法 通过 jQuery,您可以选取(查询,query) HTML 元素,并对它们执行 ...
- 当程序报无法复制dll的时候
当修改程序后,重新编译项目时经常会碰见"无法复制dll到指定路径"的问题.此时,打开任务管理器,关闭所有JP.VDS开头的进程,再重新编译项目即可
- TFS二次开发系列:二、TFS的安装
本系列的实例将采用TFS 2012+Sql Server2012编写. TFS的完整版本安装最好是在Windows server2008 64位以上版本中,其包括64位的SQL SERVER 2012 ...
- Cocos2d-x 核心概念 - Node(节点)与Node层级架构
Cocos2d-x采用层级结构管理场景 层 精灵 等节点(Node)对象 一个场景包含了多个层,一个层又包含多个对象 层级结构中的节点(Node)可以是场景,精灵等任何对象 节点的层级结构 Scene ...
- JS OOP编程
//父类 function BaseFun() { var hello = "HelloWorld"; this.HelloPublic = "Hello--World& ...
- Java知识积累2-StringReverse实现文字(单词)倒叙输出
package String; import java.util.Stack;import java.util.StringTokenizer; public class StringReverse ...
- 百度app测试服务
https://cloud.baidu.com/product/mat.html?t=cp:ct|pp:fcforbce242jrcs|cn:fcforbce242|pu:newAATJRKWS002 ...
- struts中Cookie实现记住密码
HttpServletRequest request = ServletActionContext.getRequest(); Cookie[] cookies = request.getCookie ...
- Map的五种遍历方法
package com.jackey.topic; import java.util.ArrayList;import java.util.HashMap;import java.util.Itera ...