<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>角色设置</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<%@ include file="../taglibs.jsp" %>
<!--引入样式文件和脚本文件-->
<link href="${ctx}/css/common/style1.css" style="text/css" rel="stylesheet">
<link href="${ctx}/css/dataTables/demo_page.css" style="text/css" rel="stylesheet">
<link href="${ctx}/css/dataTables/demo_table_jui.css" style="text/css" rel="stylesheet">
<link href="${ctx}/css/dataTables/demo_table.css" style="text/css" rel="stylesheet"> </head>
<script type="text/javascript" language="javascript" src="js/dataTables/jquery.js"></script>
<script type="text/javascript" language="javascript" src="js/dataTables/jquery.dataTables.js"></script>
<!--嵌入JS代码设置分页操作-->
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
$('#example').dataTable({
//iDisplayLength:1,//设置每页显示数量
sPaginationType: "full_numbers",// 设置分页按钮
//bJQueryUI: true, //设置样式
bStateSave: true
//其他具体操作属性...
});
});
</script>
<body>
<!-- 显示区域 -->
<fieldset>
<legend>角色管理</legend>
<form class="feildset clearfix dataForm ">
<table class="gridtable" style="width:100%" id="example">
<thead> <tr>
<th width="5%" align="center"><input type="checkbox" onclick="selectAll()" id="checkbox"/></th>
<th width="10%" align="center">用户名</th>
<th width="10%" align="center">真实姓名</th>
<th width="10%" align="center"> 密码</th>
<th width="5%" align="center"> 是否启用</th>
<th width="10%" align="center"> 电子邮箱</th>
<th width="10%" align="center"> 联系电话</th>
<th width="10%" align="center"> 手机号码</th>
<th width="10%" align="center"> 备注</th>
</tr>
</thead>
<tbody> <c:forEach var="user" items="${userList}">
<tr>
<td align="center"><input type="checkbox" value="${user.userId}" name="userId"/></td>
<td align="center">${user.userName} </td>
<td align="center">${user.realName}</td>
<td align="center">${user.password}</td>
<td align="center">
<c:if test="${user.whetherStop==true}">是 </c:if>
<c:if test="${user.whetherStop==false}">否 </c:if>
</td>
<td align="center">${user.email }</td>
<td align="center">${user.telephone }</td>
<td align="center">${user.mobilephone }</td>
<td align="center">${user.remarks }</td>
</tr>
</c:forEach>
</tbody>
</table>
</form>
</fieldset>
</body>
function selectAll(){
var interArr = document.getElementsByName("userId");
for ( var i = 0; i < interArr.length; i++) {
if (!interArr[i].checked) {
interArr[i].checked = true;
}
}
var checkbox=document.getElementById("checkbox");
if(!checkbox.checked){
for ( var i = 0; i < interArr.length; i++) {
interArr[i].checked = false;
}
}
}
</script>
</html>
注:必须写table的<tbody>和<thead>标签,红色区域是需要注意的地方
或参考:http://apps.hi.baidu.com/share/detail/44192495