📄 shoppingcart.jsp
字号:
<%@ page import="jnestore.javabeans.*" %>
<%@ page import="java.util.*" %>
<h3>Shopping Cart</h3>
Here are the items you have selected:<br>
<table border=1>
<tr>
<td>SKU code</td>
<td>Product</td>
<td>Description</td>
<td>Price</td>
<td> </td>
</tr>
<%
Hashtable shoppingCart = (Hashtable)session.getAttribute("shoppingcart");
if(shoppingCart == null) {
shoppingCart = new Hashtable();
session.setAttribute("shoppingcart", shoppingCart);
}
Enumeration e = shoppingCart.elements();
float total = 0;
while(e.hasMoreElements()) {
ItemInfo item = (ItemInfo)e.nextElement();
total += item.getPrice(); %>
<tr>
<td><%=item.getSku()%></td>
<td><%=item.getName()%></td>
<td><%=item.getDescription()%></td>
<td>$<%=item.getPrice()%></td>
<td><A HREF="<%=response.encodeURL("cart.jsp?operation=removeItem&sku=" + item.getSku())%>" onClick="return confirm('Are you sure you want to remove product <%=item.getSku()%>?');">[remove]</A></td>
</tr>
<% } %>
<tr>
<td> </td>
<td> </td>
<td>
<b>Total:</b>
</td>
<td><b>$<%=total%></b></td>
<td> </td>
</tr>
</table>
<BR><BR>
<A HREF="<%=response.encodeURL("cart.jsp?operation=removeAll")%>" onClick="return confirm('Are you sure you want to remove all products?');">empty shopping cart</A>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -