📄 cartmanager.jsp
字号:
<%@ page contentType="text/html; charset=GBK" language="java"%>
<%@ taglib prefix="c" uri="/WEB-INF/c.tld" %>
<%@ taglib prefix="fmt" uri="/WEB-INF/fmt.tld" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="Cache-Control" content="no-cache, must-revalidate" />
<meta http-equiv="expires" content="Wed, 26 Feb 1970 08:21:57 GMT" />
<title>购物车</title>
</head>
<script language="javascript" type="text/javascript">
function shopping(){
location.href="/lmhshop/font/show.jsp";
}
function clearCart(){
location.href="/lmhshop/servlet/CartManager?action=clear";
}
function delCart(nid){
location.href="/lmhshop/servlet/CartManager?action=delete&mcID="+nid;
}
function updateCart(nid,oldCount){
var countObj=document.getElementById("newCount_"+nid);
var newCount=countObj.value;
var str=countObj.value.replace(/[0-9]/g,"");
if(countObj.value<1||str.length!=0){
alert("所输字符含有非法字符,请输入大于等于1的数字");
countObj.value=oldCount;
}else if(confirm("确认要修改该商品的数量?")){
location.href="/lmhshop/servlet/CartManager?action=update&mcID="+nid+"&newCount="+newCount;
}
}
function checkOut(){
location.href="/lmhshop/font/user/checkOut.jsp";
}
function exitSys(obj){
location.href="/lmhshop/servlet/ExitSysServlet?tag="+obj;
}
</script>
<body><table width="100%" border="1">
<tr>
<th height="97" scope="row">
<a href="/lmhshop/font/show.jsp">首页</a>
<a href="/lmhshop/font/user/userInfo.jsp">会员中心</a>
<a href="/lmhshop/font/cartManager.jsp" >进入购物车</a>
<c:if test="${empty userBean}" >
<a href="<c:url value='/font/login.jsp' />">登录</a>
</c:if>
<c:if test="${!empty userBean}" >
<a href="#" onClick="exitSys('Font');">退出</a>
</c:if>
<a href="/lmhshop/font/reguser.jsp">注册</a>
<a href="<c:url value='/font/adminLogin.jsp'/>">后台管理</a>
</th>
</tr>
</table>
<form method="get" action="/lmhshop/servlet/ShowMcServlet" name="showForm">
<table width="100%" border="1">
<tr>
<th scope="row"><table width="93%" border="1">
<tr>
<th width="10%" scope="row">图片</th>
<th width="17%" scope="row">商品编号</th>
<th width="29%" scope="row">商品名称</th>
<th width="14%" scope="row">单价</th>
<th width="10%" scope="row">数量</th>
<th width="16%" scope="row">小计</th>
<th width="4%" scope="row">操作</th>
</tr>
<c:forEach items="${cart.mcMaps}" var="mcMaps">
<c:set value="${mcMaps.value}" var="oib" />
<tr>
<th scope="row"><img name="mcImage" src="../mcimg/${oib.simg}" width="60" height="60" alt=""></th>
<th scope="row">${oib.nmcid}</th>
<th scope="row">${oib.smcname}</th>
<th scope="row">${oib.nprice}</th>
<th align="left" scope="row">
<input name="newCount_${oib.nmcid}" type="text" id="newCount_${oib.nmcid}" value="${oib.ncount}" size="5" maxlength="5" />
<a href="#" onClick="updateCart(${oib.nmcid},${oib.ncount});return false;">修改</a></th>
<th scope="row">${oib.ntotalprice}</th>
<th scope="row">
<a href="#" onClick="delCart(${oib.nmcid});return false;">删除</a></th>
</tr>
</c:forEach>
<tr>
<th colspan="7" align="right" scope="row">合计:${cart.totalPrice} </th>
</tr>
<tr align="right">
<th colspan="7" scope="row"><a href="#" onClick=shopping() >继续购物</a>
<a href="#" onClick="clearCart();return false;">清空购物车</a> <a href="#" onClick="checkOut();">结账</a>
</th>
</tr>
</table> </th>
</tr>
</table><table width="100%" border="1">
<tr>
<th scope="row">
</th>
</tr>
</table></body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -