码迷,mamicode.com
首页 > 其他好文 > 详细

按键四;2;输入条件后接收条件与输出

时间:2017-12-14 23:51:50      阅读:191      评论:0      收藏:0      [点我收藏+]

标签:rom   gpo   username   url   w3c   public   control   sql   html 4.01   

<%@ 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>

按键四;2;输入条件后接收条件与输出

标签:rom   gpo   username   url   w3c   public   control   sql   html 4.01   

原文地址:http://www.cnblogs.com/lozjl/p/8040358.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!