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

📄 shopcar_jsp.java

📁 模仿Taobao购物网
💻 JAVA
字号:
package org.apache.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.util.*;
import taobaoproject.*;

public final class shopcar_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {

  private static java.util.Vector _jspx_dependants;

  static {
    _jspx_dependants = new java.util.Vector(1);
    _jspx_dependants.add("/check.jsp");
  }

  public java.util.List 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=GBK");
      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("\r\n");
      out.write("\r\n");
      out.write("\r\n");

if((String)session.getValue("Enter") != "true") {
  String errmsg = "error2";
  response.sendRedirect("login.jsp?errmsg="+errmsg);
}

      out.write('\r');
      out.write('\n');
      out.write("\r\n");
      out.write("<html>\r\n");
      out.write("<head>\r\n");
      out.write("<title>\r\n");
      out.write("飞梦通信:我的购物车\r\n");
      out.write("</title>\r\n");
      out.write("<LINK href=\"css/new_cart.css\" rel=stylesheet>\r\n");
      out.write("<SCRIPT language=\"JavaScript\" type=\"\">\r\n");
      out.write("function isnumber()\r\n");
      out.write("{\r\n");
      out.write("\t\tvar product_shuliang0\r\n");
      out.write("\tproduct_shuliang0= new String(document.form1.product_shuliang0.value)\r\n");
      out.write("\tif (product_shuliang0.length==0)\r\n");
      out.write("\t{\r\n");
      out.write("\t\tdocument.getElementById(\"alertMsg\").innerHTML = \"<br>您输入的数量值不能为空,请填写!<br>\"\r\n");
      out.write("\t\tdocument.getElementById('Layer2').style.display='block'\r\n");
      out.write("\t\tlocation= \"#top\";\r\n");
      out.write("\t\treturn false;\r\n");
      out.write("\t}\r\n");
      out.write("\tif(isNaN(product_shuliang0))\r\n");
      out.write("\t{\r\n");
      out.write("\t\tdocument.getElementById(\"alertMsg\").innerHTML = \"<br>您输入的数量值必须为数字,请确定重新输入!<br>\"\r\n");
      out.write("\t\tdocument.getElementById('Layer2').style.display='block'\r\n");
      out.write("\t\tlocation= \"#top\";\r\n");
      out.write("\t\treturn false;\r\n");
      out.write("\t}\r\n");
      out.write("\tif(document.form1.product_shuliang0.value < 0)\r\n");
      out.write("\t{\r\n");
      out.write("\t\tdocument.getElementById(\"alertMsg\").innerHTML = \"<br>您输入的数量值必须为大于0的整数,请确定重新输入!<br>\"\r\n");
      out.write("\t\tdocument.getElementById('Layer2').style.display='block'\r\n");
      out.write("\t\tlocation= \"#top\";\r\n");
      out.write("\t\treturn false;\r\n");
      out.write("\t}\r\n");
      out.write("\r\n");
      out.write("   return true;\r\n");
      out.write("}\r\n");
      out.write("  </SCRIPT>\r\n");
      out.write("</head>\r\n");
      out.write("<body bgcolor=\"#ffffff\">\r\n");
      org.apache.jasper.runtime.JspRuntimeLibrary.include(request, response, "head.jsp", out, true);
      out.write("\r\n");
      out.write("<table cellSpacing=0 cellPadding=5 width=\"100%\" border=0>\r\n");
      out.write("  <tr>\r\n");
      out.write("    <td>\r\n");
      out.write("      <table cellSpacing=0 cellPadding=0 width=\"100%\" border=0>\r\n");
      out.write("        <tr>\r\n");
      out.write("          <td width=\"22%\"><img height=31 src=\"images/shop-cart-header-blue.gif\" width=218 border=0 alt=\"\"></td>\r\n");
      out.write("          <td width=\"78%\"></td>\r\n");
      out.write("          <td align=right colSpan=2><a href=\"delete_all.jsp\"><img alt=清空购物车 src=\"images/az-empty-shoppingcard.gif\" border=0></a></td>\r\n");
      out.write("        </tr>\r\n");
      out.write("      </table>\r\n");
      out.write("    </td>\r\n");
      out.write("  </tr>\r\n");
      out.write("  <tr>\r\n");
      out.write("    <td>\r\n");
      out.write("      <form action=\"shopcar.jsp\" onsubmit=\"return isnumber()\">\r\n");
      out.write("      <table cellSpacing=0 cellPadding=10 width=\"100%\" border=0>\r\n");
      out.write("        <tr bgColor=#d7ebff>\r\n");
      out.write("          <td width=500 colSpan=2><STRONG>我的购物车里的商品</STRONG></td>\r\n");
      out.write("          <td width=100>\r\n");
      out.write("          <div align=center><STRONG>市场价</STRONG></div></td>\r\n");
      out.write("          <td width=100>\r\n");
      out.write("          <div align=center><STRONG>会员价</STRONG></div></td>\r\n");
      out.write("          <td width=70>\r\n");
      out.write("          <div align=center><STRONG>数量</STRONG></div></td>\r\n");
      out.write("        </tr>\r\n");
      out.write("        <!-- 购物车列表开始-->\r\n");
      out.write("        ");

        Vector buylist = (Vector)session.getValue("shopcar");
        if(buylist != null && buylist.size() > 0) {
          float pricenum = 0;
          float marketPrice = 0;
          for(int i = 0;i< buylist.size();i++) {
            ShouJI_Bean shouJi = (ShouJI_Bean)buylist.elementAt(i);
            marketPrice += shouJi.getBuynum() * shouJi.getMarketPrice();
            pricenum += shouJi.getBuynum() * shouJi.getMemberPrice();
        
      out.write("\r\n");
      out.write("        <tr vAlign=top>\r\n");
      out.write("          <td>\r\n");
      out.write("            <div align=right><SPAN class=font14><STRONG>\r\n");
      out.write("              <a href=\"delete.jsp?ati=");
      out.print(i );
      out.write("\"><IMG height=17 src=\"images/delete.gif\" width=45 border=0 alt=\"\"></A></STRONG></SPAN>\r\n");
      out.write("            </DIV>\r\n");
      out.write("          </TD>\r\n");
      out.write("          <TD><a href=\"xiangxi.jsp?goodsID=");
      out.print(shouJi.getGoodsID() );
      out.write("\"><STRONG>");
      out.print(shouJi.getGoodsName() );
      out.write("</STRONG></A>\r\n");
      out.write("          </TD>\r\n");
      out.write("          <TD width=100>\r\n");
      out.write("          <P align=center><SPAN class=price><STRONG>\r\n");
      out.write("            <FONT color=black><S>¥");
      out.print(shouJi.getMarketPrice() );
      out.write("</FONT></S></STRONG></SPAN><BR></P>\r\n");
      out.write("          </TD>\r\n");
      out.write("          <TD width=100>\r\n");
      out.write("            <DIV align=center><SPAN class=price><STRONG>¥");
      out.print(shouJi.getMemberPrice() );
      out.write("<B class=price>元</B></STRONG></SPAN>\r\n");
      out.write("            </DIV>\r\n");
      out.write("          </TD>\r\n");
      out.write("          <TD align=\"center\" width=70>\r\n");
      out.write("            <input type=\"text\" value=\"");
      out.print(shouJi.getBuynum() );
      out.write("\" size=\"2\" />\r\n");
      out.write("          </TD>\r\n");
      out.write("        </TR>");
} 
      out.write("\r\n");
      out.write("        <!-- 购物车列表结束-->\r\n");
      out.write("        <TR vAlign=top>\r\n");
      out.write("          <TD colSpan=5><IMG height=1 src=\"images/green-pixel.gif\" width=\"100%\" border=0 alt=\"\">\r\n");
      out.write("          </TD>\r\n");
      out.write("        </TR>\r\n");
      out.write("        <TR vAlign=top>\r\n");
      out.write("          <TD width=500 colSpan=2>\r\n");
      out.write("            <DIV align=right><SPAN class=price><STRONG><B><FONT\r\n");
      out.write("                  color=black>共计:</FONT></B></STRONG></SPAN>\r\n");
      out.write("            </DIV>\r\n");
      out.write("          </TD>\r\n");
      out.write("          <TD width=100>\r\n");
      out.write("            <DIV align=center><SPAN class=price><STRONG><B class=price>\r\n");
      out.write("              <FONT color=black><S>¥");
      out.print(marketPrice );
      out.write("</FONT></S></B></STRONG></SPAN>\r\n");
      out.write("            </DIV>\r\n");
      out.write("          </TD>\r\n");
      out.write("          <TD width=100>\r\n");
      out.write("            <DIV align=center><SPAN class=price>\r\n");
      out.write("              <STRONG><B class=price>¥");
      out.print(pricenum );
      out.write("元</B></STRONG></SPAN>\r\n");
      out.write("              <br /><br />\r\n");
      out.write("               <a href=\"index.jsp\"><img border=\"0\" alt=\"继续购买\" src=\"images/guomai.gif\" /></a>\r\n");
      out.write("            </DIV>\r\n");
      out.write("          </TD>\r\n");
      out.write("          <TD vAlign=top align=left width=70>\r\n");
      out.write("            <INPUT type=image alt=修改数量 src=\"images/update-t-sm.gif\" value=修改数量 name=btnModifyQuantity>\r\n");
      out.write("            <br><br>\r\n");
      out.write("              <a href=\"OrderInfo.jsp\"><img alt=\"\" src=\"images/az-by-split.gif\" border=\"0\" /></a>\r\n");
      out.write("          </TD>\r\n");
      out.write("        </TR>\r\n");
      out.write("        ");
}else { 
      out.write("\r\n");
      out.write("        <tr>\r\n");
      out.write("          <td>购物车为空!!</td>\r\n");
      out.write("        </tr>\r\n");
      out.write("        ");
} 
      out.write("\r\n");
      out.write("      </table>\r\n");
      out.write("      </form>\r\n");
      out.write("    </td>\r\n");
      out.write("  </tr>\r\n");
      out.write("</table>\r\n");
      org.apache.jasper.runtime.JspRuntimeLibrary.include(request, response, "footer.jsp", out, true);
      out.write("\r\n");
      out.write("</body>\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 + -