⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 admin.jsp

📁 JSP+ORCLE 实现后台登陆
💻 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 + -