📄 catalog.jsp
字号:
<%@ page language="java" contentType="text/html" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
<html>
<head>
<title>Product Catalog</title>
</head>
<body bgcolor="white">
<h1>Product Catalog</h1>
Please select a book from our catalog to read more about it and
decide if you like to purchase a copy:
<jsp:useBean id="catalog" scope="application"
class="com.ora.jsp.beans.shopping.CatalogBean"
/>
<%--
Generate a list of all products with links to the product page.
--%>
<ul>
<c:forEach items="${catalog.productList}" var="product">
<c:url var="productURL" value="product.jsp">
<c:param name="id" value="${product.id}" />
</c:url>
<li>
<a href="<c:out value="${productURL}" escapeXml="false" />">
<c:out value="${product.name}" /></a>
</c:forEach>
</ul>
<jsp:useBean
id="cart" scope="session"
class="com.ora.jsp.beans.shopping.CartBean"
/>
<%-- Show the contents of the shopping cart, if any --%>
<c:if test="${!empty cart.productList}">
Your shopping cart contains the following items:
<p>
<table border=0>
<c:forEach items="${cart.productList}" var="product">
<tr>
<td><c:out value="${product.name}" /></td>
<td>
<fmt:formatNumber value="${product.price}"
type="currency" />
</td>
</tr>
</c:forEach>
<tr><td colspan=2><hr></td></tr>
<tr>
<td><b>Total:</b></td>
<td>
<fmt:formatNumber value="${cart.total}"
type="currency" />
</td>
</tr>
</table>
</c:if>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -