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

📄 deptsystem.jsp

📁 用jsp和Oracle写的人事管理系统
💻 JSP
字号:
<%@ page contentType="text/html;charset=gb2312"%> 
<%@ include file="JSP/OPENDB.jsp"%>
<%! 
String replacenull(String a){ 
	if(a==null){
return "&nbsp;"; 
	}else{
return a; 
	}
} 
%> 
<%
String oabusyname = (String) session.getValue("oabusyname"); 
String oabusyusername = (String) session.getValue("oabusyusername"); 
String oabusyuserdept = (String) session.getValue("oabusyuserdept"); 
String oabusyuserlevel = (String) session.getValue("oabusyuserlevel"); 
if((oabusyusername==null)|(oabusyusername=="")){
response.sendRedirect("login.jsp"); 
}%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<link rel="stylesheet" href="css/css.css">
<script language="javascript1.2" src="js/openwin.js"></script>
<title>人事管理系统</title>
</head>
<body bgcolor="#eeeeee" topmargin="5" leftmargin="5">
 <table border="0" cellpadding="0" cellspacing="0" width="100%">
    <tr>
      <td height=68>
        <table border="0" cellpadding="0" cellspacing="0" width="100%" height="68">
          <tr>
            
<center>
<table>
<tr>
<td><b>部门管理</b>&nbsp;&nbsp;&nbsp;&nbsp</td>


</tr>
</table>
</center>
</td>
           
          </tr>
        </table>
      </td>
    </tr>
    <tr>
      <td valign=top>
        <table border="0" cellpadding="0" cellspacing="0" width="100%">
          <tr>
            <td background="images/j4.gif" width=18 height=280></td>
            <td valign=top height=280>

<br>
<center>
<%request.setCharacterEncoding("GB2312");
String dept=request.getParameter("dept");
String olddept=request.getParameter("olddept");
String id=request.getParameter("id");
String submit1="增加";
if((submit1.equals(request.getParameter("submit")))&&(dept!=null))
 {
//判断是否有与增加的部门相同的
String sql1="select * from scott.dept1 where dept='"+dept+"' "; 
ResultSet rs=stmt.executeQuery(sql1);
if(rs.next()){
%>
<font color=red><%=dept%>的部门已经存在,请选择其他部门名</font><br>
<%
}else{
stmt.executeUpdate("INSERT INTO scott.dept1(dept) VALUES('"+dept+"')");
%>
<font color=red><%=dept%>增加成功!</font>
<%
}
 }
String submit2="删除";
if(submit2.equals(request.getParameter("submit")))
 {
stmt.executeUpdate("delete from scott.dept1  where dept='"+olddept+"'");
%>
<font color=red><%=dept%>删除成功!</font>
<%
 }
String submit3="修改";
if((submit3.equals(request.getParameter("submit")))&&(dept!=null))
 {
//判断是否有与修改的部门相同的
String sql="select * from scott.dept1 where dept='"+dept+"' "; 
ResultSet rs2=stmt.executeQuery(sql);
if(rs2.next()){

%>
<font color=red><%=dept%>的部门已经存在,不能修改为此名称!</font><br>
<%
}else{
	stmt.executeUpdate("update scott.dept1 set dept='"+dept+"' where id='"+id+"'");
	stmt.executeUpdate("update scott.userinf set userdept='"+dept+"' where userdept='"+olddept+"'");
%>
<font color=red>修改成功!</font>
<%
}
 }
%>
<table border="1"  cellspacing="0" cellpadding="0">
<%
String sql3="select * from scott.dept1"; 
ResultSet rs3=stmt.executeQuery(sql3);
while(rs3.next())
	{
%>
<tr>
<form method="post" action="deptsystem.jsp">
<td>
<input type="submit" name="submit" value="删除"></td><td><input type="hidden" name="olddept" value="<%=rs3.getString("dept")%>"><input type="hidden" name="id" value=<%=rs3.getString("id")%>><input type="text" name="dept" value="<%=rs3.getString("dept")%>"></td><td><input type="submit" name="submit" value="修改"></td>
</form>
</tr>
<%
	}
%>
</table>
<form method="post" action="deptsystem.jsp">
<input type="text" name="dept"><input type="submit" name="submit" value="增加">
</form>
</center>
  </td>
            <td background="images/j5.gif" width=18 height=280></td>
          </tr>
        </table>
    </tr>
    <tr>
      <td height=19>
        <table border="0" cellpadding="0" cellspacing="0" width="100%" height="19">
          <tr>
           
          </tr>
        </table>
      </td>
    </tr>
  </table>
<center>
<a href="system.jsp">返回</a>
</center>
<%@ include file="foot.jsp"%>
</body>
</html>

⌨️ 快捷键说明

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