📄 patientdel.jsp
字号:
<%@ page contentType="text/html; charset=gb2312" language="java"
import="java.sql.*" errorPage=""%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
body {
background-color: #93A070;
}
.STYLE1 {
font-size: 24px;
font-weight: bold;
color: #000000;
}
.STYLE2 {font-size: 14px}
-->
</style>
<script type="text/JavaScript">
<!--
function MM_goToURL() { //v3.0
var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
//-->
</script>
</head>
<jsp:useBean id="Rs" scope="page" class="MyWeb.db.DBManager" />
<%
String sql = null;
String PID = null;
String Name = null;
String Age = null;
String Sex = null;
String Address = null;
String Phone = null;
String message = "";
String type = null;
ResultSet rs = null;
%>
<%
request.setCharacterEncoding("GB2312");
PID = request.getParameter("PID");
session.setAttribute("PID", PID);
//out.println(PID);
type = request.getParameter("type");
if (type == null)
type = "";
sql = "select * from patient where PID='" + PID + "'";
//out.println(sql);
try {
rs = Rs.executeQuery(sql);
while (rs.next()) {
PID = rs.getString("PID");
Name = rs.getString("Name");
Age = rs.getString("Age");
Sex = rs.getString("Sex");
Address = rs.getString("Address");
Phone = rs.getString("Phone");
}
} catch (Exception e) {
e.printStackTrace();
message = "该项目被成功删除!";
}
if (type.equals("delete")) {
sql = "delete from patient where PID='" + PID + "'";
//out.println(sql);
try {
int i = Rs.executeUpdate(sql);
message = "该项目被成功删除!";
} catch (Exception e) {
e.printStackTrace();
message = "删除失败!";
} finally {
Rs.close();
}
}
if (PID == null)
PID = "";
if (Name == null)
Name = "";
if (Age == null)
Age = "";
if (Sex == null)
Sex = "";
if (Address == null)
Address = "";
if (Phone == null)
Phone = "";
%>
<body>
<table width="380" border="1" align="center">
<tr>
<td height="45" colspan="2" align="center" valign="middle">
<span class="STYLE1">删除病人资料</span>
</td>
</tr>
<tr>
<td width="184" height="30" bgcolor="#EEEEEE">
<span class="STYLE2">姓名</span>
<input name="Name" type="text" id="Name" value="<%=Name%>"
size="15" />
</td>
<td width="186" bgcolor="#EEEEEE">
<span class="STYLE2">编号</span>
<input name="PID" type="text" id="PID" value="<%=PID%>" size="15" />
</td>
</tr>
<tr>
<td height="30" bgcolor="#EEEEEE">
<span class="STYLE2">年龄</span>
<input name="Age" type="text" id="Age" value="<%=Age%>" size="15" />
</td>
<td bgcolor="#EEEEEE">
<span class="STYLE2">性别</span>
<input name="Sex" type="text" id="Sex" value="<%=Sex%>" size="15" />
</td>
</tr>
<tr>
<td height="30" bgcolor="#EEEEEE">
<span class="STYLE2">地址</span>
<input name="Address" type="text" id="Address" value="<%=Address%>"
size="15" />
</td>
<td bgcolor="#EEEEEE">
<span class="STYLE2">电话</span>
<input name="Phone" type="text" id="Phone" value="<%=Phone%>"
size="15" />
</td>
</tr>
<tr>
<td height="30" align="center" valign="top" bgcolor="#EEEEEE">
<form id="form1" name="form1" method="post"
action="patientdel.jsp?type=delete">
<label>
<input type="submit" name="Submit" value="删除" />
</label>
<center>
<%=message%>
</center>
</form>
</td>
<td align="center" valign="top" bgcolor="#EEEEEE">
<input name="Submit2" type="submit"
onclick="MM_goToURL('parent','../main.jsp');return document.MM_returnValue"
value="返回" />
</td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -