📄 checkout_jsp.java
字号:
package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import Adam.*;
import java.util.*;
public final class checkout_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static java.util.List _jspx_dependants;
public Object getDependants() {
return _jspx_dependants;
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
JspFactory _jspxFactory = null;
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
PageContext _jspx_page_context = null;
try {
_jspxFactory = JspFactory.getDefaultFactory();
response.setContentType("text/html;charset=gb2312");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\n");
out.write(" \"http://www.w3.org/TR/html4/loose.dtd\">\n");
out.write("\n");
out.write("<html>\n");
out.write(" <head>\n");
out.write(" <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n");
out.write(" <title>结算中心</title>\n");
out.write(" </head>\n");
out.write(" <body>\n");
out.write(" ");
if((CartBean)session.getAttribute("cart")==null){ out.println("当前购物车为空"); }else{
out.write("\n");
out.write(" <form action=\"CustomerServlet\" method=\"post\">\n");
out.write(" <table align=\"left\" width=\"100%\" bgcolor=\"dddddd\" border=\"1\" cellpadding=\"0\" cellspacing=\"0\">\n");
out.write(" <tr align=\"center\">以下是你要结算的商品及数量</tr><hr>\n");
out.write(" <tr>\n");
out.write(" <td>商品名称</td>\n");
out.write(" <td>购买数量</td>\n");
out.write(" <td>商品单价</td>\n");
out.write(" <td>金额小计(元)</td>\n");
out.write(" </tr>\n");
out.write(" ");
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();
out.write("\n");
out.write(" <tr>\n");
out.write(" <td>");
out.print(cartpro..getProductName());
out.write("</td>\n");
out.write(" <td>");
out.print(cartpro.getSelectedCount());
out.write("</td>\n");
out.write(" <td>");
out.print(cartpro.getProductPrice());
out.write("</td>\n");
out.write(" ");
double smalltotal=(cartpro.getProductPrice())*(cartpro.getSelectedCount()); total=total+smalltotal;
out.write(" \n");
out.write(" <td>");
out.print(smalltotal);
out.write("</td>\n");
out.write(" </tr>\n");
out.write(" ");
}
out.write("\n");
out.write(" </table><br>\n");
out.write(" 总价(元):");
out.print(total);
out.write("<hr>\n");
out.write(" <input type=\"hidden\" value=\"checkout\" name=\"action\">\n");
out.write(" <input type=\"submit\" value=\"结算\"> \n");
out.write(" \n");
out.write(" </form>\n");
out.write(" ");
}
out.write("\n");
out.write(" <a href=\"CustomerServlet?action=getall\">继续购物</a>\n");
out.write(" \n");
out.write(" \n");
out.write(" </body>\n");
out.write(" ");
if(session.getAttribute("check")!=null){ String check=(String)session.getAttribute("check"); if(check.equals("ok")) out.println("<br><h4>已经结算成功</h4>"); session.setAttribute("check",null); }
out.write("\n");
out.write("</html>\n");
} catch (Throwable t) {
if (!(t instanceof SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
}
} finally {
if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -