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

📄 emp.jsp

📁 一个jsp的oa系统,里面有很多亮点学习!
💻 JSP
字号:
<%@ page language="java" contentType="text/html; charset=gb2312"
    pageEncoding="GBK"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<c:if test="${empty employee}">
	<c:set var="title" value="新增员工"/>
	<c:set var="method" value="add"/>
</c:if>
<c:if test="${not(empty employee)}">
	<c:set var="title" value="员工更新"/>
	<c:set var="method" value="update"/>
</c:if>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<style type="text/css">
<!--
body {
	background-color: #FFFFFF;
	background-image: url(../../Images/dw.gif);
}
.bian {
	border-top-width: 1px;
	border-right-width: 1px;
	border-bottom-width: 1px;
	border-left-width: 1px;
	border-top-style: solid;
	border-right-style: solid;
	border-bottom-style: solid;
	border-left-style: solid;
	border-top-color: #009966;
	border-right-color: #009966;
	border-bottom-color: #009966;
	border-left-color: #009966;
}
.ziti {
	font-size: 12px;
}
.STYLE1 {font-size: 18px}
.STYLE2 {color: #FF0000}
.STYLE3 {color: #FF0000; font-size: 12px; }


-->
</style>
<script language="javascript">
	function check()
	{
		var userName = document.getElementById("userName").value;
		if(userName=="")
		{
			alert("帐户名不能为空!");
			return;
		}
		
		var userPwd = document.getElementById("userPwd").value;
		if(userPwd=="")
		{
			alert("密码不能为空!");
			return;
		}
		else if(userPwd.length<6 || userPwd.length >10)
		{
			alert("密码位数不对!");
			return;
		}
		
		var name = document.getElementById("empName").value;
		if(name=="")
		{
			alert("员工姓名不能为空!");
			return;
		}
		
		var age = document.getElementById("age").value;
		if(age=="")
		{
			alert("年龄不能为空!");
			return;
		}
		else if(age.length<0 || age.length>100)
		{
			alert("年龄输入不对!");
			return;
		}
		
		var school = document.getElementById("school").value;
		if(school=="")
		{
			alert("毕业学校不能为空!");
			return;
		}
		
		var sepciality = document.getElementById("sepciality").value;
		if(sepciality=="")
		{
			alert("专业不能为空!");
			return;
		}
		
		var email;
		email = document.getElementById("email").value;
		if(email == "" || email.indexOf("@") < 0 )
		{
				alert("请正确输入E-mail!");
				return;
		}
		
		var QQ;
		QQ = document.getElementById("qq").value;
		if(isNaN(QQ))
		{
			alert("QQ格式不对!");
			return;
		}
		
		else
		{	
			if(QQ=="")
			{
				alert("QQ不能为空!!!");
				return;
			}
			
			else if(QQ.length<5 || QQ.length>12)
			{	
				alert("QQ位数不对!!!");
				return;
			}
		}
		
	
		document.getElementById("form1").submit();
	}
</script>
</head>
<body>
<h2 class="STYLE1">${title}</h2>

<c:url value="/EmployeeServlet" var="add"/>

<form id="form1"  action="${add}" method="post">
<input type="hidden" name="method" value="${method}"/>
<input type="hidden" name="empId" value="${employee.empId}"/>
  <table width="100%" border="0">
    <tr>
      <td width="120" align="right" bgcolor="#FFFFFF" class="ziti">账户名称:</td>
      <td bgcolor="#FFFFFF"><input name="userName" id="userName" type="text" class="bian" size="20" value="${employee.userName}">        
        <span class="ziti STYLE2">*带*号的为必填项</span></td>
    </tr>
    <tr>
      <td width="120" align="right" bgcolor="#FFFFFF" class="ziti">密码:</td>
      <td bgcolor="#FFFFFF"><input name="userPwd" id="userPwd" type="password" class="bian" size="20" value="${employee.userPwd}">      
          <span class="ziti STYLE2">*密码由6-10位数字组成</span></td>
    </tr>
    <tr>
      <td width="120" align="right" bgcolor="#FFFFFF" class="ziti">员工姓名:</td>
      <td bgcolor="#FFFFFF"><input name="empName" id="empName" type="text" class="bian" size="20" value="${employee.empName}">
        <span class="STYLE3">*</span></td>
    </tr>
    <tr>
    <c:if test="${employee.sex==1}">
    	<c:set var="ck" value="checked"></c:set>
      <td width="120" align="right" bgcolor="#FFFFFF" class="ziti">性别:</td>
      <td bgcolor="#FFFFFF" class="ziti">男
      <input name="sex" type="radio" value="1" ${ck}>
      &nbsp;女
      <input type="radio" name="sex" value="0" ${ck}></td>
      </c:if>
    </tr>
    <tr>
      <td width="120" align="right" bgcolor="#FFFFFF" class="ziti">年龄:</td>
      <td bgcolor="#FFFFFF"><input name="age" id="age" type="text" class="bian" size="20" value="${employee.age}">
        <span class="STYLE3">*</span></td>
    </tr>
    <tr>
      <td width="120" align="right" bgcolor="#FFFFFF" class="ziti">生日:</td>
      <td bgcolor="#FFFFFF"><input name="birthDay" id="birthDay" type="text" class="bian" size="20" value="${employee.birthDay}"></td>
    </tr>
    <tr>
      <td width="120" align="right" bgcolor="#FFFFFF" class="ziti">毕业学校:</td>
      <td bgcolor="#FFFFFF"><input name="school" id="school"type="text" class="bian" size="20" value="${employee.school}">
        <span class="STYLE3">*</span></td>
    </tr>
    <tr>
      <td width="120" align="right" bgcolor="#FFFFFF" class="ziti">专业:</td>
      <td bgcolor="#FFFFFF"><input name="sepciality" id="sepciality" type="text" class="bian" size="20" value="${employee.sepciality}">
        <span class="STYLE3">*</span></td>
    </tr>
    <tr>
      <td width="120" align="right" bgcolor="#FFFFFF" class="ziti">邮箱:</td>
      <td bgcolor="#FFFFFF"><input name="email" id="email" type="text" class="bian" size="20" value="${employee.email}">
      <span class="STYLE3">      *</span></td>
    </tr>
    <tr>
      <td width="120" align="right" bgcolor="#FFFFFF" class="ziti">qq:</td>
      <td bgcolor="#FFFFFF"><input name="qq" id="qq" type="text" class="bian" size="20" value="${employee.qq}">
        <span class="STYLE3">*</span></td>
    </tr>
    <tr>
      <td width="120" align="right" bgcolor="#FFFFFF" class="ziti">手机:</td>
      <td bgcolor="#FFFFFF"><input name="mobileTel" id="mobileTel" type="text" class="bian" size="20" value="${employee.mobileTel}"></td>
    </tr>
    <tr>
      <td width="120" align="right" bgcolor="#FFFFFF" class="ziti">电话:</td>
      <td bgcolor="#FFFFFF"><input name="tel" id="tel" type="text" class="bian" size="20" value="${employee.tel}"></td>
    </tr>
    <tr>
      <td width="120" align="right" bgcolor="#FFFFFF" class="ziti">地址:</td>
      <td bgcolor="#FFFFFF"><input name="address" id="address" type="text" class="bian" size="20" value="${employee.address}"></td>
    </tr>
    <tr>
      <td width="120" align="right" bgcolor="#FFFFFF" class="ziti">身份证号:</td>
      <td bgcolor="#FFFFFF"><input name="idCard" id="idCard" type="text" class="bian" size="20" value="${employee.idCard}"></td>
    </tr>
    <tr>
      <td width="120" align="right" bgcolor="#FFFFFF" class="ziti">工作时间:</td>
      <td bgcolor="#FFFFFF"><input name="workDate" id="workDate" type="text" class="bian" size="20" value="${employee.workDate}"></td>
    </tr>
    <tr>
      <td width="120" align="right" bgcolor="#FFFFFF" class="ziti">离职日期:</td>
      <td bgcolor="#FFFFFF"><input name="dimissionDate" id="dimissionDate" type="text" class="bian" size="20" value="${employee.dimissionDate}"></td>
    </tr>
    <tr>
      <td width="120" align="right" bgcolor="#FFFFFF">&nbsp;</td>
      <td bgcolor="#FFFFFF">&nbsp;</td>
    </tr>
    <tr>
      <td width="120" align="right" bgcolor="#FFFFFF">&nbsp;</td>
      <td bgcolor="#FFFFFF">
      <input name="Button" type="Button" class="ziti" value="提 交" onClick="check()"></td>
    </tr>
    <tr>
      <td width="120" align="right" bgcolor="#FFFFFF">&nbsp;</td>
      <td bgcolor="#FFFFFF">&nbsp;</td>
    </tr>
  </table>
  
</form>

</body>
</html>

⌨️ 快捷键说明

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