📄 user.jsp
字号:
<%@ page language="java" import="java.util.*" pageEncoding="GB2312"%>
<jsp:directive.page import="com.captainli.bean.SectorBean"/>
<jsp:directive.page import="com.captainli.dboperation.SectorDA"/>
<jsp:directive.page import="com.captainli.dboperation.LoginDA"/>
<jsp:directive.page import="com.captainli.bean.UsersBean"/>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My JSP 'user.jsp' starting page</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">
<link rel="stylesheet" type="text/css" href="../css/sys.css">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
body {
margin-left: 5px;
margin-top: 5px;
margin-right: 5px;
margin-bottom: 5px;
background-color: #FFFFFF;
}
a:link {
color: #1A438E;
text-decoration: underline;
}
a:visited {
text-decoration: underline;
}
a:hover {
text-decoration: none;
color: #000000;
}
a:active {
text-decoration: underline;
}
.style1 {
color: #1A438E;
font-size: 12px;
}
.style2 {
color:#FF0000;
font-size: 12px;
}
-->
</style>
<script type="text/javascript" language="javascript">
function CheckAll(form){
for (var i=0;i<form.elements.length;i++){
var e = form.elements[i];
if (e.name != 'chkall')
e.checked = form.chkall.checked;
}
}
function sub(){
var sid = document.getElementById("l_s_id").value;
window.location.href="user.jsp?s_id="+sid+"";
}
</script>
</head>
<%
ArrayList arry = new SectorDA().selectSector();
ArrayList arrusers = null;
int s_id = 0;//部门
if(request.getParameter("s_id") != null){
if(request.getParameter("s_id").toString().equals("0")){
arrusers = new LoginDA().selectUsers();
}else{
s_id = Integer.parseInt(request.getParameter("s_id"));
arrusers = new LoginDA().selectUsersBysid(s_id);
}
}else{
arrusers = new LoginDA().selectUsers();
}
%>
<%
int intPageSize; //一页显示的记录数
int intRowCount; //记录总数
int intPageCount;//总页数
int intPage; //待显示页码
String strPage; //请求页码
//设置一页显示的记录数
intPageSize = 10;
//取得显示的页码
strPage = request.getParameter("page");
if(strPage == null){//刚打开网页的时候,表明没有参数,此时显示第1页数据
intPage = 1;
}
else{//将字符串转换成整型
intPage = Integer.parseInt(strPage);
//if(intPage <= 1)
// intPage = 1;
}
//获取记录总数
intRowCount = arrusers.size();
//记算总页数
intPageCount = (intRowCount + intPageSize-1) / intPageSize;
int startNum = (intPage - 1) * intPageSize;//当前页起始索引
int endNum = startNum + intPageSize;//当前页结束索引
if(endNum >= arrusers.size()){
endNum = arrusers.size();
}
%>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="2" align="center">
<tr>
<td width="25%" height="30"> </td>
<td width="75%" align="right"><span class="style1">请选择部门:</span>
<select name="l_s_id" id="l_s_id" onChange="sub()">
<option value="0">--请选择部门--</option><%for(int i = 0;i < arry.size();i++){
SectorBean bean = (SectorBean)arry.get(i);%>
<option value="<%= bean.getS_id()%>" <%if(s_id == bean.getS_id()){ %>selected="selected"<%} %>><%= bean.getS_name() %></option>
<%} %>
</select> </td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#C4D8ED">
<tr>
<td><img src="../images/system/r_1.gif" alt="" width="6" height="27" /></td>
<td width="100%" background="../images/system/r_0.gif"><table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td> <span class="style1">修改 / 删除员工</span></td>
<td align="right">
<input type="button" value="添加员工" onClick="window.location.href='user_add.jsp'" class="button">
</td>
</tr>
</table></td>
<td><img src="../images/system/r_2.gif" alt="" width="6" height="27" /></td>
</tr>
<tr>
<td></td>
<td>
<form name="form1" action="user_del.jsp">
<table align="center" cellpadding="4" cellspacing="1" class="toptable grid" border="1">
<tr align="center">
<td height="30" class="category">员工编号</td>
<td class="category">员工姓名</td>
<td class="category">性别</td>
<td class="category">所属部门</td>
<td width="8%" class="category">修改</td>
<td width="5%" class="category">删除</td>
</tr>
<%
for(int i = startNum;i < endNum;i++){
UsersBean bean = (UsersBean)arrusers.get(i);//一行
%>
<tr onMouseOver="this.className='highlight'" onMouseOut="this.className=''" onDblClick="javascript:var win=window.open('user_show.jsp?lid=<%= bean.getL_id() %>','员工详细信息','width=853,height=470,top=176,left=161,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=yes'); win.focus()">
<td align="center" height="25"><%= bean.getL_no() %></td>
<td align="center"><%= bean.getL_name() %></td>
<td align="center"><%= bean.getL_sex() %></td>
<td align="center"><%= bean.getS_name() %></td>
<td align="center"><a href="user_update.jsp?lid=<%= bean.getL_id() %>"><img src="../images/system/res.gif" width="25" height="19" hspace="2" border="0" align="absmiddle">修改</a></td>
<td align="center"><%if(bean.getL_id() == 1){ %>--<%}else{ %><input type="checkbox" name="shanchu" id="shanchu" value="<%= bean.getL_id() %>" style="border:0"><%} %></td>
</tr><%} %>
<tr>
<td colspan="6" height="30" class="category">
<table align="center">
<tr>
<td>
第<%= intPage%>页 共<%= intPageCount%>页
<% //以下是分页的“上一页”“下一页”,有上一页就有链接,没有就为文字,下一页同理 %>
<% if(intPage > 1){ %>
<a href="user.jsp?page=<%= intPage-1%>&s_id=<%= s_id %>">上一页</a>
<% }else{ %>
上一页
<%}%>
<% if(intPage < intPageCount){ %>
<a href="user.jsp?page=<%= intPage+1%>&s_id=<%= s_id %>">下一页</a>
<% }else{ %>
下一页
<%}%>
</td>
</tr>
</table>
<table cellpadding=0 cellspacing=0 width="100%">
<tr>
<td align="left" class="style2">双击每行可查看员工详细资料</td>
<td align="right"><input name="chkall" type="checkbox" id="chkall" value="select" onClick="CheckAll(this.form)" style="border:0">
全选
<input type="submit" value="删 除" class="button" onClick="return confirm('此操作无法恢复!!!请慎重!!!\n\n确定要删除员工吗?')">
</td>
</tr>
</table></td>
</tr>
</table>
</form></td>
<td></td>
</tr>
<tr>
<td><img src="../images/system/r_4.gif" alt="" width="6" height="6" /></td>
<td></td>
<td><img src="../images/system/r_3.gif" alt="" width="6" height="6" /></td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -