123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- <%@ page language="java" contentType="text/html; charset=utf-8"%>
- <%@ page import="java.sql.*"%>
- <% request.setCharacterEncoding("utf-8") ;%>
- <%-- <%@ page import="com.mchange.v2.c3p0.ComboPooledDataSource" %> --%>
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>Insert title here</title>
- </head>
- <body>
- <%
- Class.forName("com.mysql.jdbc.Driver");
- String url = "jdbc:mysql://localhost:3306/kui"; //指向数据库table1
- String username = "root";
- String password = "001011";
- Connection conn = null;
- conn = DriverManager.getConnection(url, username, password);
-
- if(conn != null){
- /* Statement stmt = conn.createStatement(); */
- String result=request.getParameter("result");
- String name=request.getParameter("name");
- String calssGrent=request.getParameter("calssGrent");
-
- if(calssGrent.equals("")|name.equals("")|result.equals("")){
- response.sendRedirect("dele.jsp");
- }else{
-
- Statement stmt = null;
- ResultSet rs = null;
- PreparedStatement pstmt = null;
- //String sql = "insert into title(id,name,sex) values('"+id+"','"+name+"','"+sex+"')";
- //String sql = "INSERT INTO title (id,name,age,gender) "
- //+"VALUES (880,'菜菜',12,'女')";
-
-
- String sql = "update student set calssGrent='" + calssGrent +"',result='"+result+ "' where name='" + name + "'";
- pstmt = conn.prepareStatement(sql);
- pstmt.executeUpdate();
-
-
- out.print("<style type=\"text/css\">\r\n" +
- " @keyframes move{\r\n" +
- " 0%{\r\n" +
- " color:pink;\r\n" +
- " }\r\n" +
- " 20%{\r\n" +
- " color:skyblue;\r\n" +
- " }\r\n" +
- " 40%{\r\n" +
- " color:red;\r\n" +
- " }\r\n" +
- " 60%{\r\n" +
- " color:blue;\r\n" +
- " }\r\n" +
- " 80%{\r\n" +
- " color:green;\r\n" +
- " }\r\n" +
- " 90%{\r\n" +
- " color:gold;\r\n" +
- " }\r\n" +
- " }\r\n" +
- " h1{\r\n" +
- " animation-name: move;\r\n" +
- " animation-duration: 10s;\r\n" +
- " text-align: center;\r\n" +
- " }\r\n" +
- " a{\r\n" +
- " text-align: center;\r\n" +
- " font-size: 28px;\r\n" +
- " text-decoration: none;\r\n" +
- " }\r\n" +
- " .look{\r\n" +
- " width: 180px;\r\n" +
- " height: 40px;\r\n" +
- " border: solid;\r\n" +
- " margin: 0 auto;\r\n" +
- " text-align: center;\r\n" +
- " }\r\n" +
- " .look:hover{\r\n" +
- " background-color: pink;\r\n" +
- " }\r\n" +
- " </style>");
- out.println("<h1>恭喜!修改成功!</h1><br><br>");
- out.println("<div class=\"look\">\r\n" +
- " <a href=MMC_01>查看列表</a>\r\n" +
- " </div>");
-
- /* name=new String(name.getBytes("utf-8"));
- out.print(name); */
- // rs.next();
-
-
- }
- }
- else{
- out.print("连接失败!");
- }
-
-
-
- %>
- <br><br>
- <!-- <a href="Student.jsp"> 返回管理首页</a> -->
-
- </body>
- </html>
|