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

📄 usermanager.jsp

📁 系统包含求职用户和系统管理员两个角色
💻 JSP
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="com.publish.jxc.charpter9.*" %>
<jsp:useBean id="xmlBean" class="com.publish.jxc.charpter9.UserXMLAction" scope="request" />
<%//刷新和权限问题
	response.setHeader("Pragma","No-cache"); 
	response.setHeader("Cache-Control","no-cache"); 
	response.setDateHeader("Expires", 0);	
	String contextPath = request.getContextPath();
	if (session.getAttribute("user") == null)	{
		out.print(Utility.outPrintPage("你还没登录,无权查看此页面!", contextPath + "/index.jsp"));
		return;
	}
%>
<%
	String strAct = (String)request.getParameter("act");
	if (strAct==null)
		strAct = "show";
	String strId = request.getParameter("recordId");
	if (strId == null)
		strId = "";
%>
<html>
<head>
<title>个人求职管理系统</title>
<link rel="stylesheet" href="<%=contextPath%>/css/itsp.css" type="text/css">
<SCRIPT LANGUAGE=javascript>
function addUser()
{
	var Checkblank = /^(\s*|(\ )|(\.))*$/;
 	var Checkpassword = /^[0-9a-zA-Z_-]+$/;
 	if (Checkblank.test(dataform2.name.value))	
 	{
 		alert("用户名称不能为空!");
       	dataform2.name.focus();
	  	return false;	
	}  
  	if (Checkblank.test(dataform2.truename.value))
	{
		alert("用户实名不能为空!");
       	dataform2.truename.focus();
	  	return false;	
	} 
	if (Checkblank.test(dataform2.password.value))	 	 
	{
       	alert("用户密码不能为空!");
        dataform2.password.focus();
	  	return false;	
    }
    if (!Checkpassword.test(dataform2.password.value))	 	 
	{
    	alert("用户密码只能有26个英文字母和0~9个数字组成!");
       	dataform2.password.focus();
	  	return false;	
	}
         
	if(dataform2.password.value.length < 6)
	{
  		alert("用户密码不能少于6位!");
 		dataform2.password.focus();
 		return false;	
 	}         
 	window.dataform2.submit();
}
function updateUser()
{  	
  	var Checkblank = /^(\s*|(\ )|(\.))*$/;
  	if (Checkblank.test(dataform.truename.value))
  	{
  		alert("用户实名不能为空!");
  		dataform.truename.focus();
  	  	return false;	
  	}  
  	window.dataform.actionName.value='UPDATEUSER';
  	window.dataform.submit();
}
function deleteUser()
{  	
    if(confirm('您是否确定删除本记录,删除后将导至记录无法使用?'))
    {
  		window.dataform.actionName.value='DELETEUSER';
	  	window.dataform.submit();
	}
}
function checkform2()
{  	
  	var Checkblank = /^(\s*|(\ )|(\.))*$/;
  	if (Checkblank.test(dataform2.truename.value))
  	{
  		alert("用户实名不能为空!");
  		dataform2.truename.focus();
  	  	return false;	
  	}  
  	window.dataform2.submit();
}
</SCRIPT>
</head>
<body >
<div align="center">
  <table width="100%" border="0" cellspacing="0" cellpadding="0" height="22">
    <tr> 
      <td width="1"><img src="<%=contextPath%>/images/top_r1.GIF" width="62" height="22"></td>
      <td width=150 align="center"> 个人求职管理系统--用户管理</td>
      <td><img src="<%=contextPath%>/images/top_r2.GIF" width="294" height="22"></td>
	  <td width=100 align="center"><a href="<%=contextPath%>/index.jsp">[ 退出系统 ]</a></td>
    </tr>
  </table>
  <br>
  <br>
  <table bgcolor="#999999" align=center border=0 cellpadding=1 cellspacing=1 
width="90%">
    <tbody> 
    <tr bgcolor="#efefef" align="center" valign="middle"> 
      <td class=ttTable height=30 width="20">&nbsp;</td>
      <td class=ttTable height=30 width="0">用户名称</td>
      <td class=ttTable height=30 width="0">用户密码</td>
      <td class=ttTable height=30 width="0">用户实名</td>
      <td class=ttTable height=30 width="0"> 
        <div align="center">用户等级</div>
      </td>
      <td class=ttTable height=30 width="30"> 
        <div align="center">修改</div>
      </td>
      <td class=ttTable height=30 width="30"> 
        <div align="center">删除</div>
      </td>
    </tr>
    <form name=dataform action="/charpter9/manager" method="post" >
<%
	ArrayList userList = (ArrayList)session.getAttribute("showList");
	if (userList != null){
		int length = userList.size();
		for(int i=0; i<length; i++)	{
			UserXMLModel user = (UserXMLModel)userList.get(i);
			if (strAct.equals("modi") && strId.equals(user.getId())){
%>
    <!--显示修改的格式-->  
	<tr align="center" bgcolor="#ffffff" valign="middle"> 
      	<td class=tdsmall height=25 width="20"> 
          
          <%=(i+1)%></td>
        <td class=tdsmall height=25 width="0"><%=user.getName()%></td>
        <!--td class=tdsmall height=25><input name="name" class=stedit style="HEIGHT: 22px; WIDTH: 150px" value="getName()" maxlength="10" ></td-->
        <td class=tdsmall height=25>&nbsp; </td>
        <td class=tdsmall height=25>
          <input name="truename" class=stedit style="HEIGHT: 22px; WIDTH: 150px" value="<%=user.getTrueName()%>" maxlength="10" >
        </td>
        <td class=tdsmall height=25> 
          <select name="roles" class=stedit>
            <option value="user" <% if(user.getRoles().equals("user")){out.print("selected");}%>>用户</option>
            <option value="admin" <% if(user.getRoles().equals("admin")){out.print("selected");}%>>管理员</option>
          </select>
        </td>
        <td class=tdsmall height=25 width="25"><a href="javascript:window.dataform.recordId.value='<%=user.getId()%>';if (updateUser()==false);"><img border=0 
      height=15 src="<%=contextPath%>/images/editok.gif" width=15></a></td>
        <td class=tdsmall height=25 width="25">&nbsp;</td>
    </tr>
    <% }else{ 
    //显示正常的格式 %>
    <tr align="center" bgcolor="#ffffff" valign="middle"> 
	  <td class=tdsmall height=25 width="20"><%=(i+1)%></td>
      <td class=tdsmall height=25 width="0"><%=user.getName()%></td>
      <td class=tdsmall height=25 width="0"><%="******"%></td>
      <td class=tdsmall height=25 width="0"><%=user.getTrueName()%></td>
      <td class=tdsmall height=25 width="0"> <%=user.getRoles()%></td>
      <td class=tdsmall height=25 width="30"><a href="<%=request.getRequestURI()%>?act=modi&recordId=<%=user.getId()%>"><img border=0 
      		height=15 src="<%=contextPath%>/images/edit.gif" width=15></a></td>
      <td class=tdsmall height=25 width="30"><img border=0 
      		height=15 onClick="javascript:window.dataform.recordId.value='<%=user.getId()%>';deleteUser();" 
      		src="<%=contextPath%>/images/delete.gif" style="CURSOR: hand" width=15> </td>
    </tr>
   <%
	    	 } 
		}
	}
%>
   <input type="hidden" name="actionName" value="">
   <input type="hidden" name="recordId" value="">
   </form>
<% if (strAct.equals("addnew")){
    //显示新增的格式%>
    <tr align="center" bgcolor="#ffffff" valign="middle"> 
      <form name=dataform2 action="/charpter9/manager" method="post"  onSubmit='return addUser(this);' >
	    <input name="actionName" type="hidden" value="ADDUSER">
        <td class=tdsmall height=25 width="20"></td>
        <td class=tdsmall height=25> 
          <input name="name" class=stedit
                  style="HEIGHT: 22px; WIDTH: 150px" value="" maxlength="10" >
        </td>
        <td class=tdsmall height=25> 
          <input name="password" class=stedit type="password"
                  style="HEIGHT: 22px; WIDTH: 100px" value="" maxlength="12" >
        </td>
        <td class=tdsmall height=25>
          <input name="truename" class=stedit
                  style="HEIGHT: 22px; WIDTH: 150px" value="" maxlength="10" >
        </td>
        <td class=tdsmall height=25> 
          <select name="roles" class=stedit>
            <option value="user">用户</option>
            <option value="admin">管理员</option>
          </select>
        </td>
        <td class=tdsmall height=25 width="25"><a href="javascript:if (checkform2()==false);"><img border=0 
      height=15 src="<%=contextPath%>/images/editok.gif" width=15></a></td>
        <td class=tdsmall height=25 width="25">&nbsp;</td>
      </form>
    </tr>
<%
    } 
	out.print("</tbody></table>"); 
	out.print(Utility.getUserManagerPageSection(strAct, contextPath, request.getRequestURI()));
%>
</body>
</html>

⌨️ 快捷键说明

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