?? viewcart.jsp
字號:
<%@ page contentType="text/html; charset=gb2312" language="java" import="com.jspdev.cart.*" errorPage="../error.jsp" %>
<%@ taglib prefix="myfun" uri="http://hellking.com/function"%>
<%@ include file="../jstl.inc"%>
<jsp:useBean id="cart" class="com.jspdev.cart.Cart" scope="session"/>
<script language="javascript">
<!-- Begin validation script
function purenum(o){
var flag=0;
for(var i=0;i<o.value.length;i++)
if((o.value.charCodeAt(i)>57||o.value.charCodeAt(i)<48)&&o.value.charCodeAt(i)!=32){
flag=1;
break;
}
if(flag==1){
alert("數量只能是數字!");
return false;
}
else
return true;
}
// End of validation script -->
</script>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="../hellking.css" type=text/css rel=stylesheet>
</head>
<body>
<table align="center" bgcolor="#008800" border="0" cellspacing="2" cellpadding="5">
<tr bgcolor="#cccccc">
<td>名稱</td>
<td>單價</td>
<td>小計</td>
<td>刪除</td>
<td>更新</td>
</tr>
<c:forEach var="cartItem" items="${cart.items}">
<tr bgcolor="#cc99cc">
<td>${myfun:trans(cartItem.item.product.name)}</td>
<td>${cartItem.item.listPrice}</td>
<td>${cartItem.total}</td>
<td><a href="deleteItem_do.jsp?itemid=${cartItem.item.itemId}">刪除</a></td>
<td>
<form action="updateCart_do.jsp" name="updateform${cartItem.item.itemId}" onsubmit="return purenum(updateform${cartItem.item.itemId}.quantity)">
<input type=hidden value="${cartItem.item.itemId}" name="itemid">
<input type=text name=quantity value=${cartItem.quantity}>
<input type=submit value=更新>
</form>
</td>
</tr>
</c:forEach>
<tr bgcolor="#cccccc">
<td>合計</td>
<td colspan=4>${cart.subTotal}</td>
</tr>
</table> <br>
<center><c:if test="${! empty cart.items}"><a href="checkout.jsp">結帳</a>{{}}<a href="clearall.jsp">清空購物車</a></c:if>
{{}}<a href="viewCategory.jsp">繼續購物</a></center>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -