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

📄 cart_jsp.java

📁 项目名称eShop
💻 JAVA
字号:
package org.apache.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.text.*;
import java.util.*;
import java.math.*;
import eshop.business.*;
import eshop.common.*;

public final class cart_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,
      			"", true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\r\n");
      out.write("<html>\r\n");
      out.write("\r\n");
      out.write("<head>\r\n");
      out.write("\r\n");
      out.write("<title>购物车</title>\r\n");
      out.write("<link rel=stylesheet href=\"css/style.css\" type=\"text/css\"> \r\n");
      out.write("<meta http-equiv=\"content-type\" content=\"text/html; charset=gb2312\"></meta>\r\n");
      out.write("</head>\r\n");
      out.write("\r\n");
      out.write("<body>\r\n");
      out.write("<center>\r\n");

    CartBean cartbean=null;
    if(session.getAttribute("s_cart")==null)
    {
        out.write("<script language=javascript>alert('购物车为空');window.navigate('index.htm');</script>");
    }
    else
    {
       cartbean=(CartBean)session.getAttribute("s_cart");    
       if(cartbean.getBookItems().size()<1)
        {
           out.write("<script language=javascript>window.navigate('index.htm');</script>");
        }
    
    Iterator   itrCartItems=cartbean.getAllCartBookItems();  
    CartVO cart=cartbean.cartVOTotalPrice;
    String strTotalPrice=String.valueOf(cart.getTotalPrice());
    String strTotalEshopPrice=String.valueOf(cart.getTotalEshopPrice());
    String strTotalPriceDifference=String.valueOf(cart.getTotalPriceDifference());

      out.write("\r\n");
      out.write("<!--Top Start--> \r\n");
      out.write("<table cellspacing=\"0\" cellpadding=\"0\" width=\"800\">\r\n");
      out.write("   <tr>\r\n");
      out.write("     <td>\r\n");
      out.write("       <iframe src=\"top.jsp\" height=\"171\" width=\"810\" frameBorder=\"\"></iframe>\r\n");
      out.write("     </td>\r\n");
      out.write("   </tr>\r\n");
      out.write("</table>\r\n");
      out.write("<!--Top End--> \r\n");
      out.write("<table cellpadding=0 cellspacing=0 width=\"710\" align=center  class=\"tableBorder1\">\r\n");
      out.write("<tr align=\"center\">\r\n");
      out.write("  <td class=\"tag\"><span class=\"font-title2\">eShop商品</span></td>\r\n");
      out.write("</tr>\r\n");
      out.write("</table>\r\n");
      out.write("<p></p>\r\n");
      out.write("<form name=cartForm action=CartEventAction?action=2 method=post>\r\n");
      out.write("<table cellpadding=0 cellspacing=0 width=\"710\" align=center  class=\"tableBorder2\">\r\n");
      out.write("<tr align=\"center\" height=\"40\" style=\"font-size:16px;line-height:16;font-weight:bold;\">\r\n");
      out.write("  <td class=\"tableRow\">\r\n");
      out.write("  商品名称 \r\n");
      out.write("  </td>\r\n");
      out.write("  <td class=\"tableRow\">\r\n");
      out.write("  商城价格 \r\n");
      out.write("  </td>\r\n");
      out.write("  <td class=\"tableRow\">\r\n");
      out.write("  市场价格 \r\n");
      out.write("  </td>\r\n");
      out.write("  <td class=\"tableRow\">\r\n");
      out.write("  数量 \r\n");
      out.write("  </td>\r\n");
      out.write("  <td class=\"tableRow\">\r\n");
      out.write("  小计\r\n");
      out.write("  </td>\r\n");
      out.write("  <td class=\"tableRow\">\r\n");
      out.write("  操作 \r\n");
      out.write("  </td>\r\n");
      out.write("</tr>\r\n");
      out.write("<!--显示选中的商品Start--> \r\n");

   while(itrCartItems.hasNext())
    {
       CartVO cartItem=(CartVO)itrCartItems.next();
       BookVO book=cartItem.getBookItem();
       int intBookNum=cartItem.getBookNum();
       int intBookID=book.getBookID();

      out.write("\r\n");
      out.write("<tr align=\"center\" height=\"30\">\r\n");
      out.write("  <td class=\"tableRowlight\">\r\n");
      out.write("  <a class=\"font-book\" href=\"bookdetail.jsp?bookid=");
      out.print(intBookID);
      out.write('"');
      out.write('>');
      out.print(book.getBookName());
      out.write("</a> \r\n");
      out.write("  </td>\r\n");
      out.write("  <td class=\"tableRowlight\">\r\n");
      out.write("  ");
      out.print(book.getBookEshopPrice());
      out.write(" \r\n");
      out.write("  </td>\r\n");
      out.write("  <td class=\"tableRowlight\">\r\n");
      out.write("  ");
      out.print(book.getBookPrice());
      out.write("\r\n");
      out.write("  </td>\r\n");
      out.write("  <td class=\"tableRowlight\">\r\n");
      out.write("  <input type=\"hidden\" name=\"hi_num\" value=\"");
      out.print(intBookID);
      out.write("\">\r\n");
      out.write("  <input type=\"text\" name=\"num_");
      out.print(intBookID);
      out.write("\" value=\"");
      out.print(intBookNum);
      out.write("\">\r\n");
      out.write("  </td>\r\n");
      out.write("  <td class=\"tableRowlight\">\r\n");
      out.write("  <span class=\"font-red\">");
      out.print(cartItem.getTotalEshopPrice());
      out.write("</span>\r\n");
      out.write("  </td>\r\n");
      out.write("  <td class=\"tableRowlight\">\r\n");
      out.write("  <a href=\"CartEventAction?bookid=");
      out.print(intBookID);
      out.write("&action=3\" class=\"nav2\" >删除</a>\r\n");
      out.write("  </td>\r\n");
      out.write("</tr>\r\n");
}
      out.write("\r\n");
      out.write("<!--显示选中的商品End--> \r\n");
      out.write("<tr height=\"30\">\r\n");
      out.write("  <td class=\"tableRowlight\" colspan=\"6\" align=\"right\">市场总价:<span class=\"font-linethrough1\">");
      out.print(strTotalPrice);
      out.write("元</span>商城总计:<span class=\"font-red\">");
      out.print(strTotalEshopPrice);
      out.write("元</span>(您节省了");
      out.print(strTotalPriceDifference);
      out.write("元)</td>\r\n");
      out.write("</tr>\r\n");
      out.write("<tr height=\"40\">\r\n");
      out.write("   <td class=\"tableRow\" align=\"right\" colspan=\"6\">\r\n");
      out.write("      <input type='button' name='btnContinueShop' class=btnContinueShop value='继续购物' onclick=\"window.navigate('index.htm');\">\r\n");
      out.write("      <input type='button' name='btnClearChart' class=btnClearChart value='清空购物车' onclick=\"window.navigate('CartEventAction?action=4');\">\r\n");
      out.write("      <input type='submit' name='btnModifyNum' class=btnModifyNum value='修改数量'>\r\n");
      out.write("      <input type='button' name='btnGoPay' class=btnGoPay value='去收银台' onclick=\"window.navigate('AuthorityAction?recinfo.jsp');\">\r\n");
      out.write("   </td>\r\n");
      out.write("</tr>\r\n");
      out.write("</table>\r\n");
      out.write("</form>\r\n");
}
      out.write("\r\n");
      out.write("<p></p>\r\n");
      out.write("<!--Foot Start-->\r\n");
      out.write("<table cellspacing=\"0\" cellpadding=\"0\" width=\"800\">\r\n");
      out.write("<tr>\r\n");
      out.write("  <td>\r\n");
      out.write("    <iframe src=\"foot.htm\" height=\"80\" width=\"800\" frameBorder=\"\"></iframe>\r\n");
      out.write("  </td>\r\n");
      out.write("</tr>\r\n");
      out.write("</table>\r\n");
      out.write("<!--Foot End-->\r\n");
      out.write("</center>\r\n");
      out.write("</body>\r\n");
      out.write("\r\n");
      out.write("</html>\r\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 + -