📄 mybook.jsp
字号:
<%@ page language="java" import="java.util.*,book.*"
pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
String userName = (String) session.getAttribute("user");
if (userName == null) {
String error = "请您先输入用户名与密码登陆!";
session.setAttribute("error", error);
response.sendRedirect("error.jsp");
} else {
User user = new User(userName);
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>我的图书</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<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">
<title></title>
<link rel="stylesheet" href="Css/style.css" />
<style type="text/css">
<!--
.STYLE1 {
font-size: large
}
.STYLE2 {
font-size: medium
}
-->
</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">
<h1 align="center" class="STYLE1">
我的借阅预约
</h1>
<p align="right" class="STYLE2">
用户姓名:
<%
out.print(user.getTrueName());
%>
</p>
<div align="center">
</div>
<table width="750" height="142" border="1">
<tr>
<td>
图书名称
</td>
<td>
图书类别
</td>
<td>
借阅或预约时间
</td>
<td>
预计还书时间
</td>
<td>
状态(借阅/预约)
</td>
<td>
还书(取消预约)
</td>
</tr>
<%
if (user.getBooks().size() == 0) {
out.print("<tr><td colspan=\"6\">");
out.print("您暂时没有任何借阅或预约图书!");
out.print("</td></tr>");
} else {
for (Book aBook : user.getBooks()) {
out.print("<tr><td>");
out.print(aBook.getBookName());
out.print("</td><td>");
out.print(aBook.getDianSort());
out.print("</td><td>");
if (aBook.getState() == 1) {
out.print(aBook.getBorrowTime());
out.print("</td><td>");
out.print(aBook.getReturnTime());
out.print("</td><td>");
out.print("借阅");
out.print("</td><td>");
out
.print("<form name=\"form"
+ aBook.getBookId()
+ "\" method= \"post\" action=\""
+ "return.jsp\""
+ "> "
+ "<label><input type=\"hidden\" name=\"bookId\" value =\""
+ aBook.getBookId()
+ "\"></label>"
+ "<label><input type=\"submit\" name=\"sub\" value=\""
+ "还书\"></label></form>");
out.print("</td></tr>");
} else if (aBook.getState() == 2) {
out.print(aBook.getBookingTime());
out.print("</td><td>");
out.print("无");
out.print("</td><td>");
out.print("预约");
out.print("</td><td>");
out
.print("<form name=\"form"
+ aBook.getBookId()
+ " method= \"post\" action=\""
+ "cancel.jsp\""
+ "> "
+ "<label><input type=\"hidden\" name=\"bookId\" value =\""
+ aBook.getBookId()
+ "\"></label>"
+ "<label><input type=\"submit\" name=\"sub\" value=\""
+ "取消预约\"></label></form>");
out.print("</td></tr>");
}
}
}
}
%>
</table>
</td>
</tr>
<tr>
<td align="center">
<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 + -