department.jsp
资源名称:(J2EE)oa.rar [点击查看]
上传用户:lm2018
上传日期:2015-12-12
资源大小:30449k
文件大小:3k
源码类别:
Jsp/Servlet
开发平台:
Java
- <%@ page language="java" pageEncoding="GBK"%>
- <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
- <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
- <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
- <%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
- <script>
- var xmlhttp_request = false;
- function initrequest(){
- if(window.XMLHttpRequest){//这种就是Mozilla
- xmlhttp_request = new XMLHttpRequest();
- }else if(window.ActiveXObject){//这种浏览器是IE
- try{
- xmlhttp_request = new ActiveXObject("Msxml2.XMLHttp");
- }catch(e){
- try{
- xmlhttp_request = new ActiceXObject("microsoft.XMLHttp");
- }catch(e){
- }
- }
- }
- if(!xmlhttp_request){
- alert("您的浏览器不支持Ajax");
- return false;
- }
- }
- function processRequest(){
- if(xmlhttp_request.readystate==4){
- //完成返回结果,处理
- if(xmlhttp_request.status==200){
- //正确结果返回处理
- document.getElementById("result").innerHTML = xmlhttp_request.responseText;
- }else{
- //返回结果错误时的处理
- }
- }else{
- //未完成处理中...
- }
- }
- function ajaxcheck(){
- initrequest();
- xmlhttp_request.onreadystatechange=processRequest;
- var dname = document.getElementById("dname").value;
- var url = "dept.do?method=checkName&dname="+dname+"&sessid="+Math.random();
- xmlhttp_request.open("post",url,true);//发送请求到服务器
- xmlhttp_request.send(null);//可以传递文件,流,字符串
- }
- function checkform(){
- var dname=document.getElementById("dname");
- if(dname.value.length<=0){
- alert('部门名称不能为空!');
- dname.focus();
- return false;
- }
- }
- </script>
- <div align="center"><FONT color="red">${msg}</FONT></div>
- <html:form action="/dept">
- <html:hidden property="did"/>
- <html:hidden property="dflag"/>
- <html:hidden property="method"/>
- <table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#66CCFF" >
- <tr class="tableHead" style="font-size: 20px">
- <td height="46" colspan="2" align="center"><STRONG>部门信息编辑</STRONG></td>
- </tr>
- <tr>
- <td align="right">部门名称:</td>
- <td><html:text property="dname" onblur="ajaxcheck();"/>
- <font color="#FF0000">* <SPAN id="result"></SPAN></font></td>
- </tr>
- <tr>
- <td align="right">部门负责人:</td>
- <td><html:select property="uno">
- <html:option value="">请选择</html:option>
- <logic:present name="userlist" scope="request">
- <logic:iterate id="user" scope="request" name="userlist">
- <html:option value="${user.uno}">${user.uname}</html:option>
- </logic:iterate>
- </logic:present>
- </html:select>
- </td>
- </tr>
- <tr>
- <td align="right">部门功能:</td>
- <td><html:textarea property="dfunction" cols="50" rows="4"/></td>
- </tr>
- <tr>
- <td align="right">部门备注:</td>
- <td><html:textarea property="dmemo" cols="50" rows="5"/></td>
- </tr>
- <tr>
- <TD colspan=2><div align="center">
- <html:submit onclick="return checkform();" value="保存"/>
- <html:reset value="重置" />
- </div></TD>
- </tr>
- </table>
- </html:form>