cartlist.jsp

来自「一个很好的网上商城系统」· JSP 代码 · 共 72 行

JSP
72
字号
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <html:base />
    <title>My JSP 'cartList.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<link rel="stylesheet" type="text/css" href="../../photo/css.css">
  </head>
  
  <body>
  	<jsp:include flush="true" page="head.jsp"></jsp:include>
	<br>
    <table border="1" width="70%" align="center" cellspacing="0" cellpadding="10" bordercolor="#8000ff">
    	<tr>
    			<td colspan="7" align="center"><h3>购物车明细</h3></td>
    	</tr>
    	<tr>
    		<th>商品名</th><th>简介</th><th>单价</th><th>数量</th><th>金额</th>
    	</tr>
    	<c:forEach items="${sessionScope.cartList}" var="orderWare">
    		<form action="${pageContext.request.contextPath}/cartManage.do?method=editCartItem&&wareId=${orderWare.wares.wareId}" method="post">
    		<tr>
    			<input type="hidden" name="wareId" value="${orderWare.wares.wareId}"/>
    			<td><c:out value="${orderWare.wares.wareName}"></c:out></td>
    			<td><c:out value="${orderWare.wares.wareInfo}"></c:out></td>
    			<td><c:out value="${orderWare.wares.warePrice}"></c:out></td>
    			<td><input type="text" value="${orderWare.wareNum}" name="wareNum" size="3"/></td>
    			<td><c:out value="${orderWare.warePrice}"></c:out></td>
    			<td><input type="submit" name="submit" value="修改"/> </td>
    			<td><a href="${pageContext.request.contextPath}/cartManage.do?method=deleteCartItem&&wareId=${orderWare.wares.wareId}">删除</a></td>
    		</tr>  
    		</form> 		
    	</c:forEach>
    </table>
    <table width="70%" align="center">
    	<tr>
    		<td align="left">总金额:<c:out value="${sessionScope.account}"></c:out></td>
    	</tr>
    </table>
    <table width="70%" align="center">
    	<tr>
    		<td><a href="/shop/showWare.do?method=listAll">继续购物</a></td>
    		<td><a href="${pageContext.request.contextPath}/cartManage.do?method=deleteCart">清空购物车</a></td>
    		<td><a href="${pageContext.request.contextPath}/cartManage.do?method=cartIsNull">提交订单</a></td>
    	</tr>
    	
    </table>
    <c:if test="${requestScope.cartIsNull=='isNull'}">
    		<script type="text/javascript">
  				alert("请选择商品!");
  			</script>
    	</c:if>
  </body>
</html>

⌨️ 快捷键说明

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