⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 clientshopcar.jsp

📁 电子商务网站使用MVC模式B/S结构功能不是很全适合初学者看
💻 JSP
字号:
<%@ page contentType="text/html; charset=gb2312"%>
<%@page import="java.util.Hashtable"%>
<%@page import="java.util.ArrayList" %>
<style type="text/css">
<!--
.style3 {color: #000000}
-->
</style>
<center>
<%
	if(session.getAttribute("username".toUpperCase())==null){
		response.sendRedirect(request.getContextPath()+"/client/clientList.jsp?logged=false");
	}
//	out.print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@<br>");
	ArrayList shopList=(ArrayList)session.getAttribute("commodityList".toUpperCase());
	String id="",card="",num="",price="",picture="",commodityNum="";
	int totalPrice=0;
	if(shopList!=null)
	for(int i=0;i<shopList.size();i++){
		Hashtable table=(Hashtable)shopList.get(i);
		id=table.get("id".toUpperCase()).toString();
		card=table.get("card".toUpperCase()).toString();
		num=table.get("num".toUpperCase()).toString();
		picture=request.getContextPath()+"/image/phone/"+card+"/"+num+"/"+table.get("picture".toUpperCase()).toString();
		price=table.get("price".toUpperCase()).toString();
		price=price.substring(0,price.indexOf("."));
		commodityNum=table.get("commodityNum".toUpperCase()).toString();
		totalPrice+=Integer.parseInt(price)*Integer.parseInt(commodityNum);
		session.setAttribute("totalPrice".toUpperCase(),totalPrice);
%>
				<TABLE cellSpacing=0 cellPadding=0 width=528 border=0 >
				  <TBODY>
				  <TR vAlign=top >
					<TD width=173 height="236">
					  <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
						<TBODY>
						<TR align=middle>
						  <TD height=175><A 
									href="<%=request.getContextPath()%>/clientShowOneCommodityAction?id=<%=id%>"
								  target=_blank><IMG 
							src="<%=picture%>" width=189 height=171 align="top"></a></TD>
						</TR>
						</TBODY>
					  </TABLE>					</TD>
					<TD width=355  bgColor=#f9f6ed>
						<table width="327">
							<tr>
								<td width="319" height="32"><img src="<%=request.getContextPath()%>/image/biaoge_jiantou.jpg" width="45">&nbsp;手机品牌:<%=card%></td>
							</tr>
							<tr>
								<td height="32"><img src="<%=request.getContextPath()%>/image/biaoge_jiantou.jpg" width="45">&nbsp;手机型号:<%=num%></td>
							</tr>
							<tr>
								<td height="32"><img src="<%=request.getContextPath()%>/image/biaoge_jiantou.jpg" width="45">&nbsp;手机价格:<%=price%>(元)</td>
							</tr>
							<tr>
								<td height="32"><img src="<%=request.getContextPath()%>/image/biaoge_jiantou.jpg" width="45">&nbsp;购买数量:<%=commodityNum%>(件) </td>
							</tr>
							<tr bgColor=#eeeeee>
								  <TD height=32 align="center">
								  <%if((commodityNum.equals("1"))){
%>		
								  <a href="<%=request.getContextPath()%>/clientRemoveOneCommodityAction?id=<%=id%>">移除</a>&nbsp;
<%			  
								  }else{
%>
								  <a href="<%=request.getContextPath()%>/clientRemoveOneCommodityAction?id=<%=id%>">移除</a>&nbsp;
								  <a href="<%=request.getContextPath()%>/clientDecreaseOneCommodityAction?id=<%=id%>">移除1个</a>
<%			  
								  }
%>
					 			 </td>
						  </tr>
			  		  </table>
			      	</td>
				  </tr>
				</table>		
<%
	 }
 %>

<table width="400">
	<tr>
		<td> 总价格:<%=totalPrice%>(元)	</td>
		<td>
<%
			if(totalPrice==0){
				out.print("全部清空");
			}else{
%>
				<a href="<%=request.getContextPath()%>/clientRemoveAllCommodityAction">全部清空</a>
<%		
			}
%> 
		</td>
		<td>
<%
			if(totalPrice==0){
				out.print("确定购买");
			}else{
%>
				<a href="<%=request.getContextPath()%>/clientSubmitOrderAction">确定购买</a>
<%		
			}
%>		
		</td>
		<td><a href="javascript:window.close()">关闭</a></td>
	</tr>
</table>

</center>





⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -