?? adminmanger.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="查詢" />
<input name="resetAdmin" type="reset" id="resetAdmin" value="重置">
<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>
</c:if>
<c:if test="${userBean.ssex=='女'}">
<a href="#" onClick="updateMc('${userBean.suser}','女');" > 修改</a>
</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}條記錄數
|
${curPage}/${totalPage}
|
<c:if test="${curPage!=1}">
<a href="#" onClick="submit(1);return false;">首頁</a>
<a href="#" onClick="submit(2);return false;">上一頁</a>
</c:if>
<c:if test="${curPage!=totalPage}">
<a href="#" onClick="submit(3);return false;">下一頁</a>
<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 + -