pc_apply.jsp
上传用户:jhtang88
上传日期:2014-01-27
资源大小:28528k
文件大小:5k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html;charset=gb2312" %>
  2. <%@ page import="fan.util.*"%>
  3. <%@ include file="inc/inc.jsp" %>
  4. <jsp:useBean id="fchar" scope="page" class="cn.js.fan.util.StrUtil"/>
  5. <html><head>
  6. <meta http-equiv="pragma" content="no-cache">
  7. <meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
  8. <meta http-equiv="expires" content="wed, 26 Feb 1997 08:21:57 GMT">
  9. <title>部门管理</title>
  10. <link rel="stylesheet" href="common.css">
  11. <script language="JavaScript">
  12. <!--
  13. function validate()
  14. {
  15. if  (document.addform.hostname.value=="")
  16. {
  17. alert("新加电脑不能为空");
  18. document.addform.hostname.focus();
  19. return false ;
  20. }
  21. }
  22. function getpcinfo()
  23. {
  24. addform.hostname.value = foawarder.hostname;
  25. addform.ip.value = foawarder.hostIP;
  26. addform.info.value = foawarder.pcinfo;
  27. }
  28. //-->
  29. </script>
  30. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  31. <body bgcolor="#FFFFFF" onload="getpcinfo()">
  32.       <p>
  33.         <object id=foawarder classid="CLSID:B9CBED34-3F4A-48A5-B75B-47A25988692B" codebase="activex/FWarder.CAB" width="2" height="2"
  34. viewastext>
  35.         </object>
  36.       </p>
  37. <table width="494" border="0" align="center" cellpadding="0" cellspacing="0">
  38.   <tr> 
  39.     <td height="23" valign="bottom" background="images/tab-b5-top.gif">     <span class="right-title">办 
  40.       公 电 脑 申 请</span></td>
  41.   </tr>
  42.   <tr> 
  43.     <td height="272" valign="top" background="images/tab-b-back.gif"> 
  44.       <p>&nbsp; </p>
  45.       <table width="99%" border='0' align="center" cellpadding='0' cellspacing='0'>
  46.         <tr > 
  47.           <td width="100%" bgcolor="#F6F6F6"> 
  48.   <jsp:useBean id="userservice" scope="page" class="com.redmoon.oa.person.UserService"/> 
  49.   
  50.   <jsp:useBean id="conn" scope="page" class="com.redmoon.oa.db.Conn"/> 
  51.             <jsp:setProperty name="conn" property="POOLNAME" value="ttoa"/> 
  52.             <%
  53. String id="",hostname="",ip="",info="",username="",pwd="";
  54. String op = fchar.getNullString(request.getParameter("op"));
  55. String sql = "";
  56. if (!op.equals(""))
  57. {
  58. id = request.getParameter("id");
  59. hostname = fchar.UnicodeToGB(request.getParameter("hostname"));
  60. ip = request.getParameter("ip");
  61. info = request.getParameter("info");
  62. username = fchar.UnicodeToGB(request.getParameter("username"));
  63. pwd = request.getParameter("pwd");
  64. boolean isvalid = false;
  65. try {
  66. isvalid = userservice.isUserAccountValid(username,pwd);
  67. }
  68. catch (ErrMsgException e)
  69. {
  70. out.println(fchar.makeErrMsg(e.getMessage()));
  71. }
  72. if (isvalid)
  73. {
  74. int rowcount = 0;
  75. if (op.equals("apply"))
  76. {
  77. sql = "insert into pcinfo (username,hostname,ip,info) values ("+fchar.sqlstr(username)+","+fchar.sqlstr(hostname)+","+fchar.sqlstr(ip)+","+fchar.sqlstr(info)+")";
  78. rowcount = conn.executeUpdate(sql);
  79. if (rowcount==0)
  80. out.println(fchar.Alert("申请办公电脑未成功,请检查该电脑是否已经被申请!"));
  81. else
  82. out.println(fchar.Alert("申请成功,请等待管理员申核!"));
  83. }
  84. }
  85. if (conn!=null)
  86. {
  87. conn.close();
  88. conn = null;
  89. }
  90. }
  91. %>
  92.             <table width="100%" align="center">
  93.               <FORM METHOD=POST ACTION="pc_apply.jsp?op=apply" name="addform" onsubmit="return validate()">
  94.                 <tr> 
  95.                   <td height="24" bgcolor=#F6F6F6>用户名</td>
  96.                   <td bgcolor=#F6F6F6><input type="text" size=10 name="username" style="border:1pt solid #636563;font-size:9pt"></td>
  97.                   <td bgcolor=#F6F6F6>密码 
  98.                     <input type="password" size=15 name="pwd" style="border:1pt solid #636563;font-size:9pt"></td>
  99.                   <td align=center bgcolor=#F6F6F6>&nbsp;</td>
  100.                   <td align=left bgcolor=#F6F6F6>&nbsp;</td>
  101.                 </tr>
  102.                 <tr> 
  103.                   <td width="21%" bgcolor=#F6F6F6>机器名</td>
  104.                   <td width="18%" bgcolor=#F6F6F6>IP</td>
  105.                   <td width="24%" bgcolor=#F6F6F6>信息</td>
  106.                   <td width="12%" align=center bgcolor=#F6F6F6>&nbsp;</td>
  107.                   <td width="25%" align=left bgcolor=#F6F6F6>&nbsp;</td>
  108.                 </tr>
  109.                 <tr> 
  110.                   <td bgcolor=#F6F6F6> <input type="text" size=10 name="hostname" style="border:1pt solid #636563;font-size:9pt"> 
  111.                   </td>
  112.                   <td bgcolor=#F6F6F6><input type="text" size=15 name="ip" style="border:1pt solid #636563;font-size:9pt"></td>
  113.                   <td bgcolor=#F6F6F6><input type="text" size=32 name="info" style="border:1pt solid #636563;font-size:9pt"></td>
  114.                   <td align=center bgcolor=#F6F6F6>&nbsp;</td>
  115.                   <td align=left bgcolor=#F6F6F6> 
  116.                     <input type="submit" name="add" value="申请" style="border:1pt solid #636563;font-size:9pt; LINE-HEIGHT: normal;HEIGHT: 18px;" onClick="return  validate()"></td>
  117.                 </tr>
  118.               </form>
  119.             </table></TABLE> </td>
  120.   </tr>
  121.   <tr> 
  122.     <td height="9"><img src="images/tab-b-bot.gif" width="494" height="9"></td>
  123.   </tr>
  124. </table>
  125. </body>                                        
  126. </html>                            
  127.