📄 patientadd.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>
<body>
<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 = null;
String type = null;
ResultSet rs = null;
%>
<%
request.setCharacterEncoding("GB2312");
type = request.getParameter("type");
if (type != null) {
PID = request.getParameter("PID");
Name = request.getParameter("Name");
Age = request.getParameter("Age");
Sex = request.getParameter("Sex");
Address = request.getParameter("Address");
Phone = request.getParameter("Phone");
String sql1 = "insert into patient (";
String sql2 = "values(";
if (PID != null) {
sql1 += "PID,";
sql2 += "'" + PID + "',";
}
if (Name != null) {
sql1 += "Name,";
sql2 += "'" + Name + "',";
}
if (Age != null) {
sql1 += "Age,";
sql2 += "'" + Age + "',";
}
if (Sex != null) {
sql1 += "Sex,";
sql2 += "'" + Sex + "',";
}
if (Address != null) {
sql1 += "Address,";
sql2 += "'" + Address + "',";
}
if (Phone != null) {
sql1 += "Phone,";
sql2 += "'" + Phone + "',";
}
sql1 = sql1.substring(0, sql1.length() - 1);
sql2 = sql2.substring(0, sql2.length() - 1);
sql1 += ")";
sql2 += ")";
sql = sql1 + sql2;
out.print(sql);
try {
int i = Rs.executeUpdate(sql);
message = "完成新的病人信息的添加!";
} catch (Exception e) {
e.printStackTrace();
message = "出现异常清况,请重新添加";
}
}
if (message == null)
message = "";
%>
<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="textarea" type="text" value="" size="15" />
</td>
<td width="186" bgcolor="#EEEEEE">
<span class="STYLE2">编号</span>
<input name="textarea2" type="text" value="" size="15" />
</td>
</tr>
<tr>
<td height="30" bgcolor="#EEEEEE">
<span class="STYLE2">年龄</span>
<input name="textarea3" type="text" value="" size="15" />
</td>
<td bgcolor="#EEEEEE">
<span class="STYLE2">性别</span>
<input name="textarea4" type="text" value="" size="15" />
</td>
</tr>
<tr>
<td height="30" bgcolor="#EEEEEE">
<span class="STYLE2">地址</span>
<input name="textarea5" type="text" value="" size="15" />
</td>
<td bgcolor="#EEEEEE">
<span class="STYLE2">电话</span>
<input name="textarea6" type="text" value="" size="15" />
</td>
</tr>
<tr>
<td height="30" align="center" valign="top" bgcolor="#EEEEEE">
<form id="form1" name="form1" method="post" action="">
<input type="submit" name="Submit" value="提交" />
<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 + -