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

📄 adminmanger.jsp

📁 电子商城
💻 JSP
字号:
<%@ page contentType="text/html; charset=GBK" language="java"%>
<%@ taglib prefix="c" uri="/WEB-INF/c.tld" %> 
<%@ taglib prefix="fmt" uri="/WEB-INF/fmt.tld" %>
<c:if test="${userList==null}">
	<c:redirect url="/servlet/AdminModifyServlet" />
</c:if>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=GBK" />
		<meta http-equiv="pragma" content="no-cache" />
		<meta http-equiv="Cache-Control" content="no-cache, must-revalidate" />
		<meta http-equiv="expires" content="Wed, 26 Feb 1970 08:21:57 GMT" />
		<title>管理员用户管理</title>
	</head>
	<script language="javascript" type="text/javascript">
		function addAdmin(){
			location.replace("<c:url value='/admin/user/regAdmin.jsp'/>");
		}
		<!--分页处理-->
		function submit(pageNum){
			var pageValue=adminManagerForm.curPage.value;
			if(pageNum==1){
				pageValue=1;
			}else if(pageNum==2&&pageValue>1){
				pageValue--;
			}else if(pageNum==3&&pageValue<${totalPage}){
				pageValue++;	
			}else if(pageNum==4){
				pageValue=${totalPage};		
			}
			adminManagerForm.curPage.value=pageValue;
			adminManagerForm.submit();
		}
		function delAdmin(suser){
			if(suser=="admin"){
				alert("出错啦!不能删除用户名为admin的管理员,它是系统保留的账号");
			}else{
				location.href="/lmhshop/servlet/AdminModifyServlet?action=delete&suser="+suser;
			}
			
		}
		function updateMc(suser,ssex){
			var mcIdObj=document.getElementById("ssex");
			var mcIdVal="";
			
			if(mcIdObj!=""){
				mcIdVal=mcIdObj.value;
			}
			if(mcIdVal!="男"&&mcIdVal!="女") 
			{ 
				alert("输入含有非法字符,请输入‘男’或‘女’!");
				if(mcIdObj!=""){
					mcIdObj.value=ssex;
				} 			
				return false; 
			}else if(confirm("确认修改用户的性别?")){
				location.href="/lmhshop/servlet/AdminModifyServlet?action=update&suser="+suser+"&ssex="+mcIdVal;
				return true;
			}

		}

	</script>
<body>
<c:if test="${empty userList}">
	<table width="100%" align="center">
				<tr>
					<td align="center">
					<br>
					<br>
					<br>
					<br>
					<strong>对不起,暂无管理员用户信息!请<a href="#" onClick="addAdmin();">添加管理员</a></strong>
					<br>
					<br>
					<br>
					<br>
					</td>
				</tr>
	</table>
</c:if>
<c:if test="${!empty userList}">
<form method="get" action="<c:url value='/servlet/AdminModifyServlet' />" name="adminManagerForm">
			<input type="hidden" id="curPage" name="curPage" value="${curPage}" />
			<table width="100%">
				<tr align="center">
					<th width="14%" align="right" nowrap scope="row">
						用户名:					</th>
					<th width="18%" align="left" nowrap scope="row">					
					<c:choose>
							<c:when test="${action==null}">
							<input name="suser" type="text" id="suser" value="${param.suser}" >
							</c:when>
							<c:when test="${action!=null}">
								<input name="suser" type="text" id="suser" value="" >
							</c:when>
					  </c:choose>		
			  	  </th>
					<th width="11%" align="right" nowrap scope="row">真实姓名:</th>
					<th width="36%" align="left" nowrap scope="row">
			      <input name="sname" type="text" id="sname" value="${param.sname}" >			        </th>
				  <th width="21%" align="left" nowrap scope="row">
						  <input name="Search" type="submit" id="Search" value="查询" />
					   			  
					  &nbsp; <input name="resetAdmin" type="reset" id="resetAdmin" value="重置"> 
				  &nbsp;  <input name="addAdminBtn" type="button" id="addAdminBtn" onClick="addAdmin();" value="添加管理员"></th>
			    </tr>
  </table>
</form>
<table width="100%" border="1">
                  <tr>
                    <th width="17%" scope="row">用户名</th>
                    <th width="22%" scope="row">真实姓名</th>
                    <th width="20%" scope="row">性别</th>
                    <th width="23%" scope="row">注册时间</th>
                    <th width="18%" scope="row">操作</th>
                  </tr>
				  <c:forEach items="${userList}" var="userBean">
                  <tr>
                    <th scope="row">${userBean.suser}</th>
                    <th scope="row">${userBean.sname}</th>
                    <th scope="row"><input name="ssex" type="text" id="ssex" value="${userBean.ssex}"></th>
                    <th scope="row">${userBean.dregdate} </th>
                    <th scope="row">
					<c:if test="${userBean.ssex=='男'}">
					<a href="#" onClick="updateMc('${userBean.suser}','男');" > 修改</a>&nbsp;
					</c:if>
					<c:if test="${userBean.ssex=='女'}">
					<a href="#" onClick="updateMc('${userBean.suser}','女');" > 修改</a>&nbsp;
					</c:if>
					<a href="#" onClick="delAdmin('${userBean.suser}');">删除 </a></th>
					
                  </tr>
				  </c:forEach>
    </table>
<table width="100%" border="1">
							<tr>
								<td align="center" valign="middle">共有${countAll}条记录数
									&nbsp;&nbsp; |&nbsp; &nbsp;
									 ${curPage}/${totalPage}
								 	&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp;
									<c:if test="${curPage!=1}">
									&nbsp;<a href="#" onClick="submit(1);return false;">首页</a>
								  	&nbsp; <a href="#" onClick="submit(2);return false;">上一页</a>
									</c:if>
									<c:if test="${curPage!=totalPage}">
								 	 &nbsp; <a href="#" onClick="submit(3);return false;">下一页</a>
								 	 &nbsp; <a href="#" onClick="submit(4);return false;">尾页</a>
								  	</c:if>
							  </td>
							</tr>
	</table>
</c:if>
	
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -