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

📄 shoperlist_jsp.java

📁 jsp mysql 实现网上购物系统
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
      out.write("<script language=\"javascript\">\r\n");
      out.write("\r\n");
      out.write("function openScript(url,name, width, height){\r\n");
      out.write("\tvar Win = window.open(url,name,'width=' + width + ',height=' + height + ',resizable=1,scrollbars=yes,menubar=no,status=yes' );\r\n");
      out.write("}\r\n");
      out.write("function checklogin() {\r\n");
      out.write("\tif (document.payout.userid.value==\"\")\r\n");
      out.write("\t{\r\n");
      out.write("\t\talert(\"你还没有登录,请登录后再提交购物清单地。\");\r\n");
      out.write("\t\treturn false;\r\n");
      out.write("\t}\r\n");
      out.write("\treturn true;\r\n");
      out.write("}\r\n");
      out.write("\r\n");
      out.write("function check()\r\n");
      out.write("{\r\n");
      out.write("\tif (document.change.amount.value<1){\r\n");
      out.write("\t\talert(\"你的购买数量有问题\");\r\n");
      out.write("\t\tdocument.change.amount.focus();\r\n");
      out.write("\t\treturn false;\r\n");
      out.write("\t}\r\n");
      out.write("\treturn true;\r\n");
      out.write("}\r\n");
      out.write("\r\n");
      out.write("</script>\r\n");
      out.write("<link rel=\"stylesheet\" href=\"ware.css\" type=\"text/css\">\r\n");
      out.write("</head>\r\n");
      out.write("\r\n");
      out.write("<body  background=images/112.gif text=\"#000000\">\r\n");
      out.write("<div align=\"center\">\r\n");
      out.write("  <table width=\"750\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\">\r\n");
      out.write("    <tr> \r\n");
      out.write("      <td align=\"center\"><img src=\"images/baners2.gif\" width=\"670\" height=\"120\"></td>\r\n");
      out.write("      <td align=\"center\" width=\"80\"><a href=\"#\"></a><br>\r\n");
      out.write("        <br>\r\n");
      out.write("      </td>\r\n");
      out.write("    </tr>\r\n");
      out.write("  </table>\r\n");
      out.write("\r\n");
      out.write("  <table width=\"750\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\">\r\n");
      out.write("    <tr> \r\n");
      out.write("      <td width=\"200\">&nbsp;</td>\r\n");
      out.write("      <td width=\"55\"><a href=\"index.jsp\">首页</a></td>\r\n");
      out.write("      <td width=\"100\"><a href=\"warelist.jsp\">在线购物</a></td>\r\n");
      out.write("      <td width=\"100\"><a href=\"shoperlist.jsp\">我的购物车</a></td>\r\n");
      out.write("      <td width=\"100\"><a href=\"userinfo.jsp\">用户信息</a></td>\r\n");
      out.write("      <td><a href=\"login.jsp\">用户登录</a></td>\r\n");
      out.write("    </tr>\r\n");
      out.write("  </table>\r\n");
      out.write("  <table width=\"750\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\">\r\n");
      out.write("    <tr valign=\"top\"> \r\n");
      out.write("      <td width=\"150\"> \r\n");
      out.write("        <table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\">\r\n");
      out.write("          <tr> \r\n");
      out.write("            <td width=\"20\">&nbsp;</td>\r\n");
      out.write("            <td>本店商品分类:</td>\r\n");
      out.write("          </tr>\r\n");
      out.write("  ");
 if (classlist.excute()){
		for (int i=0;i<classlist.getClasslist().size();i++){
			wareclass bc = (wareclass) classlist.getClasslist().elementAt(i); 
      out.write("\r\n");
      out.write("          <tr> \r\n");
      out.write("            <td width=\"20\">&nbsp;</td>\r\n");
      out.write("            <td><a href=\"warelist.jsp?classid=");
      out.print( bc.getId());
      out.write('"');
      out.write('>');
      out.print( bc.getClassName() );
      out.write("</a></td>\r\n");
      out.write("          </tr>\r\n");
      out.write("  ");
	}			
  }
      out.write("\r\n");
      out.write("          <tr> \r\n");
      out.write("            <td width=\"20\">&nbsp;</td>\r\n");
      out.write("            <td>&nbsp;</td>\r\n");
      out.write("          </tr>\r\n");
      out.write("        </table>\r\n");
      out.write("        <p><img src=\"images/qrjbutton.gif\" width=\"120\" height=\"120\"></p>\r\n");
      out.write("      </td>\r\n");
      out.write("      <td align=\"center\"> \r\n");
      out.write("        <p><br>\r\n");
      out.write("         <b><font color=\"#0000FF\">我的购物车物品清单</font></b></p>\r\n");

if (!mesg.equals("") )
	out.println("<p ><font color=#ff0000>" + mesg + "</font></p>");

Vector shoplist = (Vector) session.getAttribute("shopcar");
if (shoplist==null || shoplist.size()<0 ){
	if (mesg.equals(""))
		out.println("<p><font color=#ff0000>你还没有选择购买商品!请先购买</font></p>");
} else {

      out.write("\r\n");
      out.write("       <table width=\"100%\" border=\"1\" cellspacing=\"1\" cellpadding=\"1\" bordercolor=\"#CC9966\">\r\n");
      out.write("          <tr align=\"center\"> \r\n");
      out.write("            <td>商品名称</td>\r\n");
      out.write("            <td>商品类别</td>\r\n");
      out.write("            <td>单价(元)</td>\r\n");
      out.write("            <td>数量</td>\r\n");
      out.write("            <td colspan =2>选择</td>\r\n");
      out.write("          </tr>\r\n");
      out.write("\t");
 
	float totalprice =0;
	int totalamount = 0;
	for (int i=0; i<shoplist.size();i++){
		indentlist iList = (indentlist) shoplist.elementAt(i);	
		if (book_list.getOnebook((int)iList.getBookNo())) {
			ware bk = (ware) book_list.getBooklist().elementAt(0);
			totalprice = totalprice + bk.getPrince() * iList.getAmount();
			totalamount = totalamount + iList.getAmount();
	
      out.write("\r\n");
      out.write("          <tr>\r\n");
      out.write("            <td>");
      out.print( bk.getBookName() );
      out.write("</td>\r\n");
      out.write("            <td align=\"center\">");
      out.print( bk.getClassname() );
      out.write("</td>\r\n");
      out.write("            <td align=\"center\">");
      out.print( bk.getPrince() );
      out.write("</td>\r\n");
      out.write("\t\t    <form name=\"change\" method=\"post\" action=\"shoperlist.jsp\">\r\n");
      out.write("            <td align=\"center\">\r\n");
      out.write("              <input type=\"text\" name=\"amount\" maxlength=\"4\" size=\"3\" value=\"");
      out.print( iList.getAmount() );
      out.write("\" >\t\t\t  \r\n");
      out.write("            </td>\r\n");
      out.write("            <td align=\"center\" width=55 >\r\n");
      out.write("\t\t\t<input type=\"hidden\" name=\"bookid\" value=\"");
      out.print( iList.getBookNo() );
      out.write("\" >\r\n");
      out.write("              <input type=\"submit\" name=\"modi\" value=\"修改\" onclick=\"return(check());\"></td>\r\n");
      out.write("\t\t\t<form name=\"del\" method=\"post\" action=\"shoperlist.jsp\">\r\n");
      out.write("\t\t\t <input type=\"hidden\" name=\"bookid\" value=\"");
      out.print( iList.getBookNo() );
      out.write("\" >\r\n");
      out.write("\t\t\t <td align=center width=55> <input type=\"submit\" name=\"del\" value=\"删除\">\r\n");
      out.write("            </td></form>\r\n");
      out.write("          </tr>\r\n");
      out.write("\t\t");
 } 
	} 
      out.write("  <tr><td colspan=7 align=\"right\"><br>你选择的商品的总金额:");
      out.print( totalprice);
      out.write("元&nbsp;&nbsp;总数量:");
      out.print( totalamount);
      out.write("&nbsp;</td></tr>\r\n");
      out.write("        </table>\r\n");
      out.write("       <p></p>\r\n");
      out.write("          <table width=\"90%\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\">\r\n");
      out.write("            <tr> <form name=\"payout\" method=\"post\" action=\"shoperlist.jsp\">\r\n");
      out.write("              <td align=\"right\" valign=\"bottom\"> <a href=\"warelist.jsp\">继续购物</a>&nbsp;&nbsp;&nbsp; \r\n");
      out.write("                \r\n");
      out.write("\t\t\t\t<input type=\"hidden\" name=\"userid\" value=\"");
      out.print( userid );
      out.write("\">\r\n");
      out.write("\t\t\t\t<input type=\"hidden\" name=\"totalprice\" value=\"");
      out.print( totalprice );
      out.write("\">\r\n");
      out.write("\t\t\t\t<TEXTAREA NAME=\"content\" ROWS=\"3\" COLS=\"20\">附言:</TEXTAREA><br>\r\n");
      out.write("\t\t\t\t<input type=\"submit\" name=\"payout\" value=\"提交我的购物车\" onclick=\"javascript:return(checklogin());\">&nbsp;</td></form>\r\n");
      out.write("\t\t\t\t<form name=\"form1\" method=\"post\" action=\"shoperlist.jsp\">\r\n");
      out.write("\t\t\t  <td valign=\"bottom\">&nbsp;\r\n");
      out.write("                <input type=\"submit\" name=\"clear\" value=\"清空我的购物车\">\r\n");
      out.write("              </td></form>\r\n");
      out.write("            </tr>\r\n");
      out.write("          </table>\r\n");
      out.write("        </form>\r\n");
 } 
      out.write("\r\n");
      out.write("      </td>\r\n");
      out.write("    </tr>\r\n");
      out.write("  </table>\r\n");
      out.write("  <table width=\"70%\" border=\"0\" cellspacing=\"2\" cellpadding=\"2\">\r\n");
      out.write("    <tr>\r\n");
      out.write("      <td align=\"center\">开发:王文耀<br>\r\n");
      out.write("        CopyRight@2006 <br>\r\n");
      out.write("        Email:<a href=\"mailto:wwy170@163.com\">wwy170@163.com</a></td>\r\n");
      out.write("    </tr>\r\n");
      out.write("  </table>\r\n");
      out.write("  \r\n");
      out.write("</div>\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 + -