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

📄 showcart.jsp

📁 《J2EE企业级应用开发》一书的配套源代码
💻 JSP
字号:
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<%@ page contentType="text/html;charset=gb2312" import="java.util.*,com.j2eeapp.cdstore.vo.*,java.util.*" errorPage="error.jsp" %> 
<title>J2EE 应用开发 </title>

<jsp:include page="header.jsp" flush="true"/>
<jsp:include page="sidebar.jsp" flush="true"/>
<jsp:useBean id="shoppingSession" scope="session" class="com.j2eeapp.cdstore.bean.ShoppingSession" />
<IMG height=35 alt="" src="images/shopping_cartbanner.gif" width=160 border=0><br>

 <table border="0" cellspacing="0" cellpadding="2" width="500">

   <tr>
   <th background="images/titlebar_stretch.gif" valign="top" class="title" align="left">名称</th>
   <th background="images/titlebar_stretch.gif" align="right" valign="center" class="title">价格 </th>
   <th background="images/titlebar_stretch.gif" align="right" valign="center" class="title">数量 </th>
   <th background="images/titlebar_stretch.gif" align="right" valign="center" class="title"> 删除</th>
   </tr>
   <%
   if(shoppingSession.getItems().size()!=0&&shoppingSession.isLoggedIn())
   {
      Collection c=shoppingSession.getItems();
	  Iterator it=c.iterator();

	  while(it.hasNext())
	  {
	  	CartItem cartItem=(CartItem)it.next();
		%>
		<tr>
		 <td class="heading"><a href="showdetails.jsp?productId=?<%=cartItem.getProductId()%>" class="heading"><%=cartItem.getName()%></a></td>
		 <td class="heading"><%=cartItem.getUnitCost()%></td>
		 <form action="update" method="post" name="update"><input type="hidden" name="itemId" value="<%=cartItem.getItemId()%>">
 		 <td class="heading" align="center"><input type="text" name="newQuantity" value="<%=cartItem.getQuantity()%>"><input type="submit" value="更新"></td>
		 </form>
		 <td class="heading"><a href="removeitem?itemId=<%=cartItem.getItemId()%>" class="heading">删除</a></td>
		 </tr>
		 <% }//while
		 %>
		<tr><td bordercolor="#00FF00"><a href="deleteall">清空购物车</a> </td>
		<td bordercolor="#00FF00"><a href="category.jsp">继续购物</a></td>
		<td bordercolor="#00FF00"><a href="checkout_step1.jsp">结帐 </a></td>
		<td bordercolor="#00FF00"></td>
		</tr>		
	  <%
   }//if
  else if (shoppingSession.getItems().size()!=0&& !shoppingSession.isLoggedIn() ) {
  %>
  <i>你必须先<a href="loginform">登陆</a> before you can purchase the items in your shopping cart</i>
  <%
  } else {
  %>
  <i>你的购物车没有物品</i><a href="category.jsp">继续购物</a>
  <%
  }
  %>
     </table>
      <jsp:include page="footer.jsp" flush="true"/>
   

⌨️ 快捷键说明

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