📄 booking.jsp
字号:
<%@ page language="java" import="java.util.*,book.*,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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
<link rel="stylesheet" href="Css/style.css" />
<style type="text/css">
<!--
.STYLE1 {
font-size: 30px;
font-weight: bold;
color: #FF0000;
}
.STYLE2 {
font-size: 24px;
font-weight: bold;
}
-->
</style>
</head>
<body>
<table width="800" border="0" align="center" cellpadding="0"
cellspacing="0">
<tr>
<td width="22" background="images/bg_left.gif">
</td>
<td width="760">
<table width="760" height="568" border="0" align="center"
cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td height="126" align="center">
<img src="images/bg_top.gif" width="761" height="126">
</td>
</tr>
<tr>
<td height="347" valign="top" class="STYLE1">
<%
String userName = (String) session.getAttribute("user");
int num = 0;
if (userName == null) {
String error = "请您先输入用户名与密码登陆!";
session.setAttribute("error", error);
response.sendRedirect("error.jsp");
} else {
String sql = "SELECT id FROM user WHERE username='" + userName + "'";
int userId = 1;
ResultSet rs = DbConnect.query(sql);
try {
while (rs.next()) {
userId = rs.getInt("id");
}
} catch (Exception e) {
e.printStackTrace();
}
sql = "INSERT INTO booking(bookid,bookingid,booking_time) values"
+ "('" + request.getParameter("bookId") + "','"
+ userId + "','2009-02-05')";
num = DbConnect.update(sql);
if (num == 0) {
out.print("预约失败");
} else {
out.print("预约成功");
}
}
%>
<p align="center">
<a href="user.jsp" class="STYLE2">返回</a>
</p>
</td>
</tr>
<tr>
<td align="center" class="tableBorder_LR">
</td>
</tr>
</table>
<td width="19" background="images/bg_right.gif">
</td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -