📄 checkout.jsp
字号:
<%@page contentType="text/html"%><%@page pageEncoding="gb2312"%><%@ page import="Adam.*" %><%@ page import="java.util.*" %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>结算中心</title> </head> <body> <% if((CartBean)session.getAttribute("cart")==null){ out.println("当前购物车为空"); }else{ %> <form action="CustomerServlet" method="post"> <table align="left" width="100%" bgcolor="dddddd" border="1" cellpadding="0" cellspacing="0"> <tr align="center">以下是你要结算的商品及数量</tr><hr> <tr> <td>商品名称</td> <td>购买数量</td> <td>商品单价</td> <td>金额小计(元)</td> </tr> <% double total=0; CartBean cartbean=(CartBean)session.getAttribute("cart"); Hashtable cartHash=cartbean.getCartContent(); Enumeration cartEnu=cartHash.elements(); while(cartEnu.hasMoreElements()){ CartProduct cartpro=(CartProduct)cartEnu.nextElement(); %> <tr> <td><%=cartpro.getProductName()%></td> <td><%=cartpro.getSelectedCount()%></td> <td><%=cartpro.getProductPrice()%></td> <% double smalltotal=(cartpro.getProductPrice())*(cartpro.getSelectedCount()); total=total+smalltotal; %> <td><%=smalltotal%></td> </tr> <% } %> </table><br> 总价(元):<%=total%><hr> <input type="hidden" value="checkout" name="action"> <input type="submit" value="结算"> </form> <% } %> <a href="CustomerServlet?action=getall">继续购物</a> </body> <% if(session.getAttribute("check")!=null){ String check=(String)session.getAttribute("check"); if(check.equals("ok")) out.println("<br><h4>已经结算成功</h4>"); session.setAttribute("check",null); } %></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -