<%@ page language="java" import="java.util.*" import="java.sql.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP ‘update_stu_3.jsp‘ starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<title>修改后重写记录页面</title>
<body>
<%
String driverName="com.mysql.jdbc.Driver";
String dbName="MyLogin";
String userName="root";
String userPwd="lovezjl";
String url1="jdbc:mysql://localhost:3306/MyLogin";
String url2="?user=root&password=lovezjl";
String url3="&useUnicode=true&characterEncoding=UTF-8";
String url=url1+url2+url3;
Class.forName(driverName);
Connection conn=DriverManager.getConnection(url);
String sushe3=request.getParameter("sushe");
String shuliang3=request.getParameter("shuliang2");
String jiedan3=request.getParameter("jiedan2");
String song3=request.getParameter("song2");
String sql="update student_xinxi1 set shuliang=?,jiedan=?,song=? where sushe=‘"+sushe3+"‘";
PreparedStatement pstmt=conn.prepareStatement(sql);
request.setCharacterEncoding("UTF-8");
pstmt.setString(1,shuliang3);
pstmt.setString(2,jiedan3);
pstmt.setString(3,song3);
int n=pstmt.executeUpdate();
if(n>=1){%>重写数据操作成功!<br><%}
else{ %>重写数据操作失败!<% %><br><%}
if(pstmt!=null){pstmt.close();}
if(conn!=null){conn.close();}
%>
</body>
</html>