adminstudent2.jsp
上传用户:mkymky1985
上传日期:2014-06-23
资源大小:754k
文件大小:2k
源码类别:

其他数据库

开发平台:

Java

  1. <%@ page language = "java" contentType = "text/html;charset=gb2312"%>
  2. <%@ page import = "java.sql.*,wsxk.*" %>
  3. <jsp:useBean id="subject" scope="page" class="wsxk.ConDB"/>
  4. <%! String trans(String chi)
  5. {
  6.                String result = null;
  7.                byte temp [];
  8.                try
  9.                 {
  10.                       temp=chi.getBytes("iso-8859-1");
  11.                       result = new String(temp, "gb2312");
  12.                 }
  13.                 catch(Exception e)
  14.                 {
  15.                         System.out.println (e.toString());
  16.                 }
  17.                 return result;
  18. }
  19. %>
  20. <%
  21. String stuid = new String (request.getParameter("stuid"));
  22. String stuname = new String (request.getParameter("stuname"));
  23. String stuno = new String (request.getParameter("stuno"));
  24. String stugrade = new String (request.getParameter("stugrade"));
  25. String stupsw = new String (request.getParameter("stupsw"));
  26. System.out.println (stuid);
  27. //System.out.println("EEEE333");
  28. String str = null;
  29. String str2 = "";
  30. %>
  31. <% if (stuid.trim().equals("")||stuname.trim().equals("")||stuno.trim().equals("")||stupsw.trim().equals(""))
  32. {response.sendRedirect("adminstudenterr.htm");}
  33. else{String sql2 = "insert into student(stuid, stupsw, stuname, stuno, stugrade) values('" + stuid + "','" +stupsw+ "','" + trans(stuname) + "','" + stuno + "','" +stugrade+ "')";
  34. subject.executeUpdate(sql2);}
  35. %>
  36. <html>
  37. <head>
  38. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  39. <meta HTTP-EQUIV=REFRESH CONTENT="10; URL=adminstudent.jsp">
  40. <link href="_notes/aaa.css" rel="stylesheet" type="text/css">
  41. <style type="text/css">
  42. <!--
  43. @import url("_notes/ccc");
  44. body,td,th {
  45. font-size: 12px;
  46. color: #FFFFFF;
  47. font-weight: bold;
  48. }
  49. .style1 {color: #000000}
  50. -->
  51. </style>
  52. </HEAD>
  53. <BODY BGCOLOR=#0D85A6 BACKGROUND="images/bg.gif" >
  54. <div align="center">
  55.   <p align="left">    <br>
  56.   学生注册成功,本页将于10秒内自动<a href="adminstudent.jsp" class="style1">返回前页</a></p>
  57.   <p><br>
  58.     <img src="images/qa.jpg" width="640" height="427"></p>
  59. </div>
  60. </BODY>
  61. </HTML>