使用MongoDB和JSP实现一个简单的购物车系统实例(11)

<%@ page language="java" import="java.util.*" contentType="text/html;charset=gb2312" import="com.liuzhen.shop.MongodbBean" pageEncoding="gb2312"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"https://www.jb51.net/"; %> <jsp:useBean scope="session"/> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="https://www.jb51.net/<%=basePath%>"> <title>购物车</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"> <meta http-equiv="Content-Type" content="text/html;charset=gb2312"> <link type="text/css" href="https://www.jb51.net/css/login.css"> </head> <body> <div> <div> <% if(cart.isEmpty()) { %> <font color="red" size="20">购物车中没有任何商品!!!</Font> <% } else { %> <h2>购物车</h2> <table> <tr> <td>物品编号</td> <td>物品名</td> <td>定价</td> <td>数量</td> <td>求购</td> </tr> <% String[][] ssa=cart.getCart(); for(int i=0;i<ssa.length;i++) { %> <tr> <td><%= ssa[i][0] %></td> <td><%= ssa[i][1] %></td> <td><%= ssa[i][2] %></td> <td> <form action="Buy.jsp" method="post"> <input type="text" value="<%= ssa[i][3] %>"> <input type="hidden" value="<%= ssa[i][0] %>"> <input type="hidden" value="gc"> </form> </td> <td><a href="Buy.jsp?sid=<%= ssa[i][0] %>&action=del">删除</a></td> </tr> <% } %> </table> <br> <br> 本订单总价为:<%= Math.round(cart.getTotal()*100)/100.0%> <% } %> <br> <div> <button>继续购物</button> </div> </div> </div> </body> </html>

附:源码下载:源码

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wzjxds.html