%--
Copyright 2001 Sun Microsystems, Inc. All Rights Reserved.
This software is the proprietary information of Sun Microsystems, Inc.
Use is subject to license terms.
--%>
<%@ include file="initdestroy.jsp" %>
<%@ page import="java.util.*, cart.*" %>
Shopping Cart
<%@ include file="banner.jsp" %>
<%
String bookId = request.getParameter("Remove");
if (bookId != null) {
cart.remove(bookId);
bookDB.setBookId(bookId);
BookDetails book = bookDB.getBookDetails();
%>
You just removed: <%=book.getTitle()%>
<%
}
if (request.getParameter("Clear") != null) {
cart.clear();
%>
You just cleared your shopping cart!
<%
}
// Print a summary of the shopping cart
int num = cart.getNumberOfItems();
if (num > 0) {
%>
You have <%=num%> <%=(num==1 ? " item" : " items")%> in your shopping cart.
Quantity |
Title |
Price |
<%
Iterator i = cart.getItems().iterator();
while (i.hasNext()) {
ShoppingCartItem item = (ShoppingCartItem)i.next();
BookDetails book = (BookDetails)item.getItem();
%>
<%=item.getQuantity()%>
|
<%=book.getTitle()%>
|
|
Remove Item
|
<%
// End of while
}
%>
|
Subtotal: |
|
|
Continue Shopping
Check Out
Clear Cart
<%
} else {
%>
There is nothing in your shopping cart.
Back to the Catalog
<%
// End of if
}
%>