📄 bookshowcart.jsp
字号:
<jsp:useBean id="cart" class="cart.ShoppingCart" scope="session"/><sql:setDataSource driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost/bookstore?user=lyp&password=pwd&useUnicode=true&characterEncoding=gb2312"/><c:if test="${param.Clear == 'clear'}"> <% cart.clear(); %> <font color="red" size="+2"><strong> <fmt:message key="CartCleared"/> </strong></font> <br><br></c:if><c:if test="${param.Remove != '0'}"> <c:set var="bookId" value="${param.Remove}"/> <jsp:useBean id="bookId" type="java.lang.String" /> <% cart.remove(bookId); %> <sql:query var="books"> select * from books where id = ? <sql:param value="${bookId}" /> </sql:query> <c:forEach var="book" begin="0" items="${books.rows}"> <font color="red" size="+2"> <fmt:message key="CartRemoved"/><em>${book.title}</em>. </font> </c:forEach> <br><br> </c:if><c:if test="${sessionScope.cart.numberOfItems > 0}"> <font size="+2"> <fmt:message key="CartContents"/> ${sessionScope.cart.numberOfItems} <c:if test="${sessionScope.cart.numberOfItems == 1}"> <fmt:message key="CartItem"/>. </c:if> <c:if test="${sessionScope.cart.numberOfItems > 1}"> <fmt:message key="CartItems"/>. </c:if> </font> <br> <table> <tr> <th align=left><fmt:message key="ItemQuantity"/></TH> <th align=left><fmt:message key="ItemTitle"/></TH> <th align=left><fmt:message key="ItemPrice"/></TH> </tr> <c:forEach var="item" items="${sessionScope.cart.items}"> <c:set var="book" value="${item.item}" /> <tr> <td align="right" bgcolor="#ffffff"> ${item.quantity} </td> <td bgcolor="#ffffaa"> <c:url var="url" value="/bookdetails" > <c:param name="bookId" value="${book.bookId}" /> <c:param name="Clear" value="0" /> </c:url> <a href="${url}"><b>${book.title}</b></a> </td> <td bgcolor="#ffffaa" align="right"> <fmt:formatNumber value="${book.price}" type="currency"/> </td> <td bgcolor="#ffffaa"> <c:url var="url" value="/bookshowcart" > <c:param name="Remove" value="${book.bookId}" /> </c:url> <a href="${url}"><b><fmt:message key="RemoveItem"/></b></a> </td> </tr> </c:forEach> <tr> <td colspan="5" bgcolor="#ffffff"> </td> </tr> <tr> <td colspan="2" align="right" bgcolor="#ffffff"> <fmt:message key="Subtotal"/> </td> <td bgcolor="#ffffaa" align="right"> <fmt:formatNumber value="${sessionScope.cart.total}" type="currency"/> </td> <td></td> </tr> </table> <br> <c:url var="url" value="/bookcatalog" > <c:param name="Add" value="" /> </c:url> <a href="${url}"><b><fmt:message key="ContinueShopping"/></b></a> <c:url var="url" value="/bookcashier" /> <a href="${url}"><b><fmt:message key="Checkout"/></b></a> <c:url var="url" value="/bookshowcart" > <c:param name="Clear" value="clear" /> <c:param name="Remove" value="0" /> </c:url> <a href="${url}"/><b><fmt:message key="ClearCart"/></b></a><</c:if><c:if test="${sessionScope.cart.numberOfItems <= 0}"> <font size="+2"><fmt:message key="CartEmpty"/></font> <br><br> <c:url var="url" value="/bookcatalog" > <c:param name="Add" value="" /> </c:url> <strong><a href="${url}"><fmt:message key="Catalog"/></a></strong></c:if></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -