📄 catalog.jsp
字号:
<%@page contentType="text/html; charset=gb2312"%>
<%@ include file="common.jsp"%>
<%@ include file="incoming/check.jsp"%>
<%@page import="java.util.Collection,java.util.Iterator"%>
<jsp:useBean id="cart" scope="session" class="beans.CartBean" />
<html>
<head>
<title>欢迎光临E-BOOK网上书店</title>
<link href="incoming/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<%@ include file="incoming/header.jsp"%>
<jsp:include page="additem.jsp" flush="false" />
<h1>
本网站销售的图书有:
</h1>
<p>
<%
Collection<BookBean> cl=bookdb.getBooks();
Iterator<BookBean> it=cl.iterator();
%>
<table>
<tr>
<th>
书名
</th>
<th>
价格
</th>
<th>
购买
</th>
</tr>
<%
while(it.hasNext())
{
BookBean book=(BookBean)it.next();
String title=book.getTitle();
int bookId=book.getId();
float price=book.getPrice();
%>
<tr>
<td>
<a href="bookinfo.jsp?id=<%=bookId%>">《<%=title%>》</a>
</td>
<td><%=price%></td>
<td>
<a href="catalog.jsp?add=<%=bookId%>"><img src="images/buy.gif"
width="45" height="16" border="0"">
</a>
</td>
</tr>
<%
}
%>
</table>
<p>
购物车中现有<%=cart.getNumOfItems()%>种图书
<a href="showcart.jsp">查看购物车</a><br>
<%@ include file="incoming/footer.jsp"%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -