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

📄 employee.jsp

📁 一个hibernate加spring学习的例子
💻 JSP
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page language="java" contentType="text/html; charset=GBK" pageEncoding="GBK"%>
<%@ taglib uri="/WEB-INF/htxx-tag.tld" prefix="hxtg"%>
<html>
  <head>
    <title>员工信息</title>
    <hxtg:head></hxtg:head>
    
    <script type='text/javascript' src='../dwr/engine.js'></script>
    <script type='text/javascript' src='../dwr/util.js'></script>
    <script type='text/javascript' src='../hxtg/public/dwr/util.js'></script>
    <script type='text/javascript' src='../dwr/interface/EmployeeBus.js'></script>
    <script type='text/javascript' src='../dwr/interface/DepartmentBus.js'></script>
  </head>
  <body onload="init()">
	<hxtg:title text="员工信息">
		<hxtg:titleitem><hxtg:button text="保存" onclick="save()"/></hxtg:titleitem>
		<hxtg:titleitem><hxtg:button text="关闭" onclick="goback()"/></hxtg:titleitem>
	</hxtg:title>
	<input type="hidden" id="employeeId">
	<hxtg:table type="single">
		<hxtg:tr type="single">
			<hxtg:td type="single" width="10%">姓名</hxtg:td>
			<hxtg:td type="single" width="30%"><input id="name" type="text" style="width:90%"/></hxtg:td>
			<hxtg:td type="single" width="10%">性别</hxtg:td>
			<hxtg:td type="single" width="30%">
				<input id="nosex" name="sex" type="radio"/>未确定
				<input id="male" name="sex" type="radio"/>男
				<input id="female" name="sex" type="radio"/>女
			</hxtg:td>
		</hxtg:tr>
		<hxtg:tr type="single">
			<hxtg:td type="single">部门</hxtg:td>
			<hxtg:td type="single" rowspan="3"><select id="department.departmentId" style="width:90%"></select></hxtg:td>
		</hxtg:tr>
	</hxtg:table>
	
  </body>
  <script type="text/javascript">
  var depCache={};
  function init(condition){
  	DepartmentBus.findDepartment(null,function(resultset){
  		addOptions("department.departmentId",resultset.collection,"departmentId","departmentName");
  		var dep;
  		for(var i=0; i<resultset.collection.length; i++){
  			dep = resultset.collection[i];
  			depCache[dep.departmentId] = dep;
  		}
  	});
  }
  function add(){
  	var emp = new Employee();
  	setValues(emp);
  	$("department.departmentId").options[0].selected=true;
  }
  function edit(empid){
  	EmployeeBus.getEmployee(empid,function(vo){
  		setValues(vo);
  		if(vo.sex===0){$("male").checked=true;}
  		else if(vo.sex===1){$("female").checked=true;}
  		else{$("nosex").checked=true;}
  	});
  }
  function goback(){
  	window.parent.goback();
  }
  function save(){
  	var employee = new Employee();
  	dwr.util.getValues(employee);
  	
  	var department = new Department();
  	dwr.util.getValues(department,{prefix:"department"});
  	employee.department = depCache[department.departmentId];
  	
  	if($("male").checked){employee.sex=0;}
  	if($("female").checked){employee.sex=1;}
  	employee.hireDate=new Date();
  	
  	if(employee.employeeId===''){employee.employeeId=null;}
  	saveObj(employee,function(department){
  			if(confirm("你是否确认保存'"+employee.name+"'?")){
  				EmployeeBus.updateEmployee(employee);
  				goback();
  				window.parent.init();
  				return true;
  			}
  		});
  }
  </script>
</html>

⌨️ 快捷键说明

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