📄 user.jsp
字号:
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="book.*"%>
<%
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");
}
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<title>图书管理</title>
<head>
<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
}
.STYLE3 {
font-size: 14px
}
-->
</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">
<a href="mybook.jsp">我的借阅</a>
</p>
<div align="center">
</div>
<table width="748" height="99" border="1">
<tr>
<td>
<a href="http://www.hao123.com">图书名称</a>
</td>
<td>
图书类别
</td>
<td>
图书分类
</td>
<td>
作者
</td>
<td>
出版社
</td>
<td>
图书状态
</td>
<td>
借阅/预约
</td>
</tr>
<%
Admin admin = new Admin();
for (Book aBook : admin.getBooks()) {
out.print("<tr><td>");
out.print("<a href=\"borrow.jsp?bookId=" + aBook.getBookId()
+ "&bookState=" + aBook.getState() +"\">");
out.print(aBook.getBookName());
out.print("</a></td><td>");
out.print(aBook.getDianSort());
out.print("</td><td>");
out.print(aBook.getStandardSort());
out.print("</td><td>");
out.print(aBook.getAuthor());
out.print("</td><td>");
out.print(aBook.getPublish());
out.print("</td><td>");
if (aBook.getState() == 2) {
out.print("借阅,预约中");
out.print("</td><td>");
out.print("<form name=\"form"
+ aBook.getBookId()
+ "\" method= \"post\" action=\""
+ "booking.jsp\""
+ "> "
+ "<label><input type=\"hidden\" name=\"bookId\" value =\""
+ aBook.getBookId()
+ "\"></label>"
+ "<label><input type=\"hidden\" name=\"bookState\" value =\""
+ aBook.getState()
+ "\"></label>"
+ "<label><input type=\"submit\" name=\"sub\" value=\""
+ "预约\" disabled=\"true\"/></label></form>");
} else if (aBook.getState() == 1) {
out.print("借阅中");
out.print("</td><td>");
out.print("<form name=\"form"
+ aBook.getBookId()
+ "\" method= \"post\" action=\""
+ "booking.jsp\""
+ "> "
+ "<label><input type=\"hidden\" name=\"bookId\" value =\""
+ aBook.getBookId()
+ "\"></label>"
+ "<label><input type=\"hidden\" name=\"bookState\" value =\""
+ aBook.getState()
+ "\"></label>"
+ "<label><input type=\"submit\" name=\"sub\" value=\""
+ "预约\"></label></form>");
} else {
out.print("书架上");
out.print("</td><td>");
out.print("<form name=\"form"
+ aBook.getBookId()
+ "\" method= \"post\" action=\""
+ "borrow.jsp\""
+ "> "
+ "<label><input type=\"hidden\" name=\"bookId\" value =\""
+ aBook.getBookId()
+ "\"></label>"
+ "<label><input type=\"hidden\" name=\"bookState\" value =\""
+ aBook.getState()
+ "\"></label>"
+ "<label><input type=\"submit\" name=\"sub\" value=\""
+ "借阅\"></label></form>");
out.print("</td></tr>");
}
}
%>
</table>
</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 + -