succChan.jsp 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <%@ page language="java" contentType="text/html; charset=utf-8"%>
  2. <%@ page import="java.sql.*"%>
  3. <% request.setCharacterEncoding("utf-8") ;%>
  4. <%-- <%@ page import="com.mchange.v2.c3p0.ComboPooledDataSource" %> --%>
  5. <!DOCTYPE html>
  6. <html>
  7. <head>
  8. <meta charset="utf-8">
  9. <title>Insert title here</title>
  10. </head>
  11. <body>
  12. <%
  13. Class.forName("com.mysql.jdbc.Driver");
  14. String url = "jdbc:mysql://localhost:3306/kui"; //指向数据库table1
  15. String username = "root";
  16. String password = "001011";
  17. Connection conn = null;
  18. conn = DriverManager.getConnection(url, username, password);
  19. if(conn != null){
  20. /* Statement stmt = conn.createStatement(); */
  21. String result=request.getParameter("result");
  22. String name=request.getParameter("name");
  23. String calssGrent=request.getParameter("calssGrent");
  24. if(calssGrent.equals("")|name.equals("")|result.equals("")){
  25. response.sendRedirect("dele.jsp");
  26. }else{
  27. Statement stmt = null;
  28. ResultSet rs = null;
  29. PreparedStatement pstmt = null;
  30. //String sql = "insert into title(id,name,sex) values('"+id+"','"+name+"','"+sex+"')";
  31. //String sql = "INSERT INTO title (id,name,age,gender) "
  32. //+"VALUES (880,'菜菜',12,'女')";
  33. String sql = "update student set calssGrent='" + calssGrent +"',result='"+result+ "' where name='" + name + "'";
  34. pstmt = conn.prepareStatement(sql);
  35. pstmt.executeUpdate();
  36. out.print("<style type=\"text/css\">\r\n" +
  37. " @keyframes move{\r\n" +
  38. " 0%{\r\n" +
  39. " color:pink;\r\n" +
  40. " }\r\n" +
  41. " 20%{\r\n" +
  42. " color:skyblue;\r\n" +
  43. " }\r\n" +
  44. " 40%{\r\n" +
  45. " color:red;\r\n" +
  46. " }\r\n" +
  47. " 60%{\r\n" +
  48. " color:blue;\r\n" +
  49. " }\r\n" +
  50. " 80%{\r\n" +
  51. " color:green;\r\n" +
  52. " }\r\n" +
  53. " 90%{\r\n" +
  54. " color:gold;\r\n" +
  55. " }\r\n" +
  56. " }\r\n" +
  57. " h1{\r\n" +
  58. " animation-name: move;\r\n" +
  59. " animation-duration: 10s;\r\n" +
  60. " text-align: center;\r\n" +
  61. " }\r\n" +
  62. " a{\r\n" +
  63. " text-align: center;\r\n" +
  64. " font-size: 28px;\r\n" +
  65. " text-decoration: none;\r\n" +
  66. " }\r\n" +
  67. " .look{\r\n" +
  68. " width: 180px;\r\n" +
  69. " height: 40px;\r\n" +
  70. " border: solid;\r\n" +
  71. " margin: 0 auto;\r\n" +
  72. " text-align: center;\r\n" +
  73. " }\r\n" +
  74. " .look:hover{\r\n" +
  75. " background-color: pink;\r\n" +
  76. " }\r\n" +
  77. " </style>");
  78. out.println("<h1>恭喜!修改成功!</h1><br><br>");
  79. out.println("<div class=\"look\">\r\n" +
  80. " <a href=MMC_01>查看列表</a>\r\n" +
  81. " </div>");
  82. /* name=new String(name.getBytes("utf-8"));
  83. out.print(name); */
  84. // rs.next();
  85. }
  86. }
  87. else{
  88. out.print("连接失败!");
  89. }
  90. %>
  91. <br><br>
  92. <!-- <a href="Student.jsp"> 返回管理首页</a> -->
  93. </body>
  94. </html>