⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 catalog.jsp

📁 自己写的基于JSP+servlet+Javabean的bookshop源代码
💻 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()%>种图书 &nbsp;&nbsp;&nbsp;&nbsp;
			<a href="showcart.jsp">查看购物车</a><br>
			<%@ include file="incoming/footer.jsp"%>
	</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -