<%@ 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 ‘delete_stu_2.jsp.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>
<head><title>利用提交条件删除记录页面</title></head>
<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);
request.setCharacterEncoding("UTF-8");
String ss1=request.getParameter("s11");
String sql="delete from student_xinxi1 where sushe=‘"+ss1+"‘";
PreparedStatement stmt=conn.prepareStatement(sql);
int n=stmt.executeUpdate();
if(n==1){%>数据删除操作成功!<br><%}
else {%>数据删除操作失败!<br><%}
if(stmt!=null){stmt.close();}
if(conn!=null){conn.close();}
%>
<style type="text/css">
body{
background:url("image/444.jpg");
background-size:100%;
}
</style>
</body>
</html>