?? goods_management.jsp
字號:
<%@ page contentType="text/html; charset=gb2312" language="java"%>
<%@ page import="java.sql.*"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>歡迎光臨網(wǎng)上商城</title>
<link rel=stylesheet type=text/css href="./lib/ware.css">
<jsp:useBean scope="page" id="Ware" class="com.chapter14.Ware" />
<jsp:useBean scope="page" id="Sort" class="com.chapter14.Sort" />
<jsp:useBean scope="page" id="Goods" class="com.chapter14.Goods" />
</head>
<body bgcolor="#F4FFFE">
<%
//獲取當(dāng)前訪問用戶的用戶名
String sUserName = (String) session.getAttribute("UserName");
//獲取當(dāng)前訪問用戶的索引號
long lUserID = (Long) session.getAttribute("UserID");
Goods.setUserID(lUserID);
//獲取當(dāng)前訪問用戶購物車中的所有信息
ResultSet rs = Goods.show_my_goods();
%>
<div align="center">
<table width="90%" cellpadding="0" cellspacing="0" border="1">
<tr bgcolor="#0066FF">
<td width="100%" height="30" align="center" colspan="6"><font color="#FFFFFF"><%=sUserName%> 的購物車</font></td>
</tr>
<tr>
<td width="25%" height="25" align="center"><font color="#0000FF">商品名稱</font></td>
<td width="15%" height="25" align="center"><font color="#0000FF">商品產(chǎn)地</font></td>
<td width="20%" height="25" align="center"><font color="#0000FF">生產(chǎn)廠家</font></td>
<td width="10%" height="25" align="center"><font color="#0000FF">價格</font></td>
<td width="15%" height="25" align="center"><font color="#0000FF">購買數(shù)量</font></td>
<td width="15%" height="25" align="center"><font color="#0000FF">從購物車中清除</font></td>
</tr>
<%
float total = 0; //所有商品的總價
//循環(huán)顯示所有購物信息
while(rs.next())
{
long lGoodsID = rs.getLong("GoodsID");
Ware.setWareID(rs.getLong("WareID"));
Ware.init();
int iBuyNumber = rs.getInt("BuyNumber");
//計算商品總價
total = iBuyNumber * Ware.getPrice() + total;
%>
<tr>
<td width="25%" height="25" align="left"> <a href="ware_detail.jsp?WareID=<%=Ware.getWareID()%>" target="_self"><font color="#0000FF"><%=Ware.getWareName()%></font></a></td>
<td width="15%" height="25" align="left"> <%=Ware.getCompany()%></td>
<td width="20%" height="25" align="left"> <%=Ware.getAddr()%></td>
<td width="10%" height="25" align="left"> <%=Ware.getPrice()%></td>
<td width="15%" height="25" align="center"><%=iBuyNumber%></td>
<td width="15%" height="25" align="center"><input type="button" name="btn" value="清除" onClick='javascript:window.location="delete_goods.jsp?GoodsID=<%=lGoodsID%>"'></td>
</tr>
<%
}
%>
<tr>
<td height="30" align="center" colspan="6">總計:<font color="#0000FF"><%=total%></font> (RMB)</td>
</tr>
</table>
<%rs.close();%>
</div>
</body>
</html>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -