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的更多相关文章
随机推荐
- mysql 替换某个字段中的某个字符
遇到这么个情况: 比如: Msql里面的某个表的某个字段里面存储的是一个人的地址,有一天这个地址的里面的某个地 名变了,那么他的地址也就要变: 比如: 原来是: number ...
- nodejs路由的部分通配
1. 占位标识符/:id app.get('/post_api_post_data_ren/bet/follow/:gameEn',function(req,res){ console.log(req ...
- No module named 'urllib2'
import urllib2 response = urllib2.urlopen('http://www.baidu.com/') html = response.read() print html ...
- 30-React JSX IN DEPTH
JSX IN DEPTH JSX 从根本上说,JSX只是提供了语法糖React.createElement(component, props, ...children)的功能.以下JSX代码: < ...
- docker里重装mysql
1.查看ubuntu下装了什么软件: dpkg -l 2.删除mariadb: apt-get autoremove --purge mariadb-server-10.0 apt-get remov ...
- JS事件模型小结
三种事件模型:原始事件模型(DOM0),DOM2事件模型,IE事件模型: 不同点: 事件程序的注册(给HTML元素所对应的JS对象绑定事件) 事件传播的过程 事件模型的注册: 一.原始事件模型(没有兼 ...
- django一对多关系的小例题
urls.py from django.conf.urls import urlfrom django.contrib import adminfrom son1.views import * url ...
- 命名空间$.fn
$.fn.xxx是可以用对象来调用的命名空间,例如 $.fn.input() 在声明时就可以用 $('abc').input() $.fx是指jquery的特效. 如果使用显示.滑动.淡入淡出. ...
- comparator接口与compare方法的实现
刷leetcodecode时看到一道题需要利用自定义的比较器进行排序,最开始一头雾水,看了API终于懂了~ Arrays.sort(T[] a,Comparator<? super T> ...
- Android和iOS常用命令学习(真机)
1. 安装应用: Android: adb install xxx.apk iOS: ideviceinstaller -i xxx.ipa 2. 卸载应用 Android: abd uninstal ...