📄 checkcart.jsp
字号:
<%@ page language="java" import="java.util.*,java.sql.*,db.*,bean.*"
pageEncoding="gb2312"%>
<jsp:directive.page import="common.Format;" />
<html>
<head>
<title>购物车</title>
</head>
<body>
<table width="80%" align=center>
<tr>
<td>
<jsp:include page="top.jsp" />
</td>
</tr>
<tr>
<td>
<jsp:include page="advertise.jsp"/>
</td>
</tr>
</table>
<br>
<font size="5" color="brown"> 查看购物车</font>
<a href="bookworm.jsp">继续购买</a>
<br>
<%
Hashtable buyedBooks = null;
double totalPrice = 0;//原总价
double totalPriceDiscount = 0;//折后总价
int bookCount = 0;
try {
%>
<p>
<center>
<table height=40 cellSpacing=0 cellPadding=10 width="80%" border=0>
<tr bgColor=#d7ebff>
<td colSpan=2 width=300>
<strong>购物车里的书本</strong>
</td>
<td width=100>
<div align=center>
<strong>原价</strong>
</td>
<td width=100>
<div align=center>
<strong>折后价</strong>
</td>
<td width=70>
<div align=center>
<strong>数量</strong>
</td>
</tr>
<%
Cart myCart = (Cart) session.getAttribute("myCart");
if (myCart == null)
myCart = new Cart();
buyedBooks = myCart.listMyBooks();
Enumeration enume = buyedBooks.keys();
while (enume.hasMoreElements()) {
String bookKey = (String) enume.nextElement();
byte[] b = bookKey.getBytes("ISO-8859-1");
bookKey = new String(b);
ResultSet rs = dbOperation.getBookInfo(bookKey);
rs.next();
String bookName = rs.getString("book_name");
double price = rs.getDouble("price");
double rebate = rs.getDouble("price_rebate");
double priceDiscount = price * rebate * 0.1;
bookCount = ((Integer) buyedBooks.get(bookKey)).intValue();
totalPrice += price * bookCount;
totalPriceDiscount += priceDiscount * bookCount;
%>
<tr>
<td colSpan=2>
<form id="listBook" action="removeBook" method="post">
<input type="hidden" name="bookID" value=<%=bookKey%>>
<input type="image" alt="删除" src="./webpic/delete.gif" border="0"
name="image1">
<%=bookName%>
</form>
</td>
<td align=center>
<s><%=Format.numFormat(price)%> </s>
</td>
<td align=center>
<%=Format.numFormat(priceDiscount)%>
<td align=center>
<form id="updateBookCount" action="addBook" method="post">
<input type="text" size=3 style="border:0" maxlength=3
name="bookCount" value=<%=bookCount%>>
<input type="hidden" name="bookID" value=<%=bookKey%>>
<input type="image" alt="更新数量" src="./webpic/update-t-sm.gif"
border="0" name="image2">
</form>
</td>
</tr>
<%
}
%>
</table>
<hr width="90%" size=2>
<table cellSpacing=0 cellPadding=10 width="80%" border=0>
<tr>
<td colSpan=2 width=300>
<div align=right>
<strong>共计:</strong>
</td>
<td width=100>
<div align=center>
<strong><font color=black><s><%=Format.numFormat(totalPrice)%>
</s>
</strong>
</td>
<td width=100>
<div align=center>
<strong><font color=brown><%=Format.numFormat(totalPriceDiscount)%>
</strong>
</td>
<td width=70>
<div align=center>
<strong></strong>
</td>
</tr>
</table>
<p>
<table width="80%">
<tr>
<td width=300>
</td>
<td align=center>
<form action="orderForm" method="post">
<input type="image" alt="结算" src="./webpic/by-split.gif"
border="0" name="image1">
</form>
</td>
</tr>
</table>
<%
} catch (Exception e) {
out.print(e);
}
%>
<br>
<br>
<div>
<table cellSpacing=0 cellPadding=10 width="80%" border=0>
<tr valign="top" bgcolor="EEEECC">
<td colspan="5" class="font14">
<strong> 小贴士</strong>
</td>
</tr>
<tr valign="top">
<td colspan="5">
<ul>
<li>
您可以根据需要自行输入所要购买书籍的数量。
</li>
<li>
请在登陆后提交订单。
</li>
</ul>
</td>
</tr>
</table>
</div>
<jsp:include page="bottom.txt" />
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -