?? admin.jsp
字號:
<%@ page contentType="text/html; charset=gb2312" import="java.sql.*"%>
<jsp:useBean id="db" class="xwfb.connectDB" />
<html>
<head>
<title>用戶管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link href="css/style.css" rel="stylesheet" type="text/css">
<script language="javascript">
function deal(para)
{
if(para == 1)
{
add_form.action = "user_deal.jsp?action=delete";
add_form.submit();
}
if(para == 2)
{
add_form.action = "user_deal.jsp?action=grad";
add_form.submit();
}
if(para == 3)
{
add_form.action = "user_deal.jsp?action=degrad";
add_form.submit();
}
if(para == 4)
{
window.close();
}
}
</script>
</head>
<body>
<%
if("3".equals((String)session.getAttribute("priority")))
{
ResultSet rs = null;
try
{
String sql = "select * from XWFB_USER";
rs = db.executeQuery(sql);
int i = 0;
if(rs.next())
{
%>
<form name="add_form" method="post" action="user_deal.jsp">
<table>
<tr>
<td colspan="3">
<input type="button" class="commonbutton" value="刪除用戶" onclick="deal(1)">
<input type="button" class="commonbutton" value="設為新聞員" onclick="deal(2)">
<input type="button" class="commonbutton" value="降為普通用戶" onclick="deal(3)">
<input type="button" class="commonbutton" value="關閉窗口" onclick="deal(4)">
</td>
</tr>
<tr>
<td width="20%">選擇</td>
<td width="40%">用戶</td>
<td width="40%">權限</td>
</tr>
<%
String name = rs.getString("username");
String pr = rs.getString("priority");
%>
<tr>
<td width="20%">
<%
if(!"3".equals(pr))
{
%>
<input type="checkbox" name="choose" value="<%=name%>">
<%
}
%></td>
<td width="40%"><%=name%></td>
<td width="40%"><%="1".equals(pr) ? "普通用戶" : ("2".equals(pr) ? "新聞員" : "管理員")%></td>
</tr>
<%
while(rs.next())
{
i++;
name = rs.getString("username");
pr = rs.getString("priority");
%>
<tr>
<td width="20%"><%
if(!"3".equals(pr))
{
%>
<input type="checkbox" name="choose" value="<%=name%>">
<%
}
%></td>
<td width="40%"><%=name%></td>
<td width="40%"><%="1".equals(pr) ? "普通用戶" : ("2".equals(pr) ? "新聞員" : "管理員")%></td>
</tr>
<%
}
%>
</table>
</form>
<%
}
else
{
%>
沒有可以管理的用戶!
<%
}
}
catch(Exception e)
{
session.setAttribute("error","1");
response.sendRedirect("error.jsp");
}
finally
{
try
{
db.closeDB();
rs.close();
}
catch(Exception ee)
{
session.setAttribute("error","1");
response.sendRedirect("error.jsp");
}
}
}
else
{
response.sendRedirect("index.jsp");
}
%>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -