淘宝商城jsp部分
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <table width="100%" border="1" class="abc"> <tr> <td colspan="3" bgcolor="#FFFF99"> </td> </tr> <tr bgcolor="#A4C6EC"> <td width="16%" height="127"><img src="images/8.gif" width="179" height="101" /></td> <td width="59%"><img src="images/10.gif" width="690" height="99" /></td> <td width="25%"><p><img src="images/u50289223-2.jpg" width="48" height="48" />【我的账号】</p> <p><img src="images/2009083013100611.jpg" alt="" width="67" height="56" /><a href="ShoppingClServlet?type=show">【我的购物车】</a></p></td> </tr> <tr> <td colspan="3" bgcolor="#FFFF99"> </td> </tr> <tr> <td colspan="3"><table width="100%" border="1"> <tr> <td width="11%"> </td> <td width="11%" class="navi">首页</td> <td width="11%"> </td> <td width="11%" class="navi">大陆电影</td> <td width="11%"> </td> <td width="11%" class="navi">外国电影</td> <td width="11%"> </td> <td width="11%" class="navi">关于我们</td> <td width="11%"> </td> </tr> </table></td> </tr> </table>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>My JSP 'index.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- 这里引用css文件 --> <link rel="stylesheet" type="text/css" href="css/my.css"> </head> <body> <table width="80%" border="1" align="center"> <tr> <td height="91" colspan="2" align="center"> <!-- 引入head.jsp --> <jsp:include flush="true" page="head.jsp"></jsp:include> </td> </tr> <tr> <td width="21%" height="271" align="center"> <jsp:include flush="true" page="left.jsp"></jsp:include> </td> <td width="72%" align="center"> <jsp:include flush="true" page="right.jsp"></jsp:include> </td> </tr> <tr> <td height="79" colspan="2" align="center"> <jsp:include flush="true" page="tail.jsp"></jsp:include> </td> </tr> </table> </body> </html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <table width="100%" border="1" align="center" class="abc"> <tr> <td align="center"><img src="images/4.gif" width="50" height="68" /></td> </tr> <tr> <td align="center">流动广告</td> </tr> <tr> <td align="center"><table width="100%" border="1" align="center"> <tr> <td colspan="3" align="center"><img src="images/7.gif" width="70" height="59" /><img src="images/7.gif" alt="" width="73" height="59" /><img src="images/7.gif" alt="" width="73" height="59" /></td> </tr> <tr> <td align="center">排行榜</td> <td align="center">商品名称</td> <td align="center">点击次数</td> </tr> <tr> <td align="center">1</td> <td align="center">天龙八部</td> <td align="center">99</td> </tr> <tr> <td align="center">2</td> <td align="center">天龙八部</td> <td align="center">97</td> </tr> <tr> <td align="center">3</td> <td align="center">天龙八部</td> <td align="center">80</td> </tr> <tr> <td align="center">4</td> <td align="center">天龙八部</td> <td align="center">77</td> </tr> <tr> <td align="center">5</td> <td align="center">天龙八部</td> <td align="center">65</td> </tr> <tr> <td align="center">6</td> <td align="center">天龙八部</td> <td align="center">55</td> </tr> <tr> <td align="center">7</td> <td align="center">天龙八部</td> <td align="center">34</td> </tr> </table></td> </tr> </table>
<%@ page language="java" import="java.util.*,com.xf.model.*" pageEncoding="utf-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; //得到GoodsBeanBo完成分页 GoodsBeanBO gbb=new GoodsBeanBO(); //接受pageNow String s_pageNow=(String)request.getAttribute("abc"); int pageNow=1; //默认值 if(s_pageNow != null) { //string->int pageNow=Integer.parseInt(s_pageNow); } ArrayList a1=gbb.getGoodsByPage(6,pageNow); //得到前6个项目,当前页面时第一页 //得到要分页的数目 int pageCount=gbb.getPageCount(6); %> <table width="100%" border="1" class="abc"> <tr> <td height="23" colspan="3"><img src="images/10.gif" width="500" height="45" /></td> </tr> <% //循环写入数据,每个小table都是一个数据项 //分成两行,每行3个 for(int i=0 ; i != 2 ; ++i) { //分行 %> <tr> <% //每行3个 for(int j=3*i ; j != (i+1)*3 ; ++j) { //取出GoodsBean GoodsBean gb=new GoodsBean(); if(j >= a1.size()) { //当前的取值比a1的上限还大 //无法继续取值 //默认给一个goodsBean gb.setGoodsId(0); gb.setGoodsIntro("肖锋专用!!已经没货"); gb.setGoodsName("绝世好图"); gb.setGoodsPrice(0.0f); gb.setPhoto("11.jpg"); } else { gb=(GoodsBean)a1.get(j); } %> <td width="33%" height="170"><table width="101%" height="175" border="1"> <tr> <td width="3%" rowspan="3"><img src="images/<%=gb.getPhoto() %>" width="112" height="112" /></td> <td width="97%" height="47"> </td> </tr> <tr> <td height="34"><a href="showGoodsClServlet?type=showDetail&id=<%=gb.getGoodsId() %>"><%=gb.getGoodsName() %></a></td> </tr> <tr> <td height="26">价格:<%=gb.getGoodsPrice() %></td> </tr> <tr> <td height="51" colspan="2">简单介绍:<%=gb.getGoodsIntro() %></td> </tr> </table></td> <% } %> </tr> <% //判断是否是第一行结束 if(i != 1) {//如果是,那么吧中间那点花边插进去 %> <tr> <td colspan="3" bgcolor="#A4C6EC"> </td> </tr> <% } %> <% } %> <tr> <td height="23" colspan="3" align="center"> <% //for循环得到页面标签草链接 for(int i=1 ; i != pageCount+1 ; ++i) { %> <a href="showGoodsClServlet?type=fenye&pageNow=<%=i %>">【<%=i %>】</a> <% } %> </td> </tr> </table>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>My JSP 'shopping2.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <link rel="stylesheet" type="text/css" href="css/my.css"> </head> <body topmargin="0"> <table width="80%%" border="1" align="center"> <tr> <td align="center"> <jsp:include flush="true" page="head.jsp"></jsp:include> </td> </tr> <tr> <td align="center"><table width="100%%" border="1" class="abc"> <tr> <td height="43" align="left"><img src="images/web_development/shoppingcart.png" width="124" height="43" /><img src="images/web_development/arrow_next.png" width="124" height="43" /><img src="images/web_development/female.png" width="124" height="43" /><img src="images/web_development/arrow_next.png" alt="" width="124" height="43" /><img src="images/web_development/application.png" width="124" height="43" /><img src="images/web_development/arrow_next.png" alt="" width="124" height="43" /><img src="images/web_development/action_check.png" width="124" height="43" /></td> </tr> <tr> <td height="29" align="center"> <form action="loginCl" method="post"> <table width="50%" border="1"> <tr> <td colspan="2" align="center"><img src="images/web_development/user.png" width="211" height="30" /></td> </tr> <tr> <td width="50%" align="right">用户名:</td> <td width="50%"><label for="textfield"></label> <input name="username" type="text" id="textfield" size="20" /></td> </tr> <tr> <td align="right">密 码:</td> <td><input name="password" type="text" id="textfield2" size="20" /></td> </tr> <tr> <td align="right"><input type="submit" name="button" id="button" value="用户登录" /></td> <td align="left"><input type="submit" name="button2" id="button2" value="用户注册" /></td> </tr> </table> </form> </td> </tr> <tr> <td align="right">下一步<img src="images/web_development/arrow_next.png" alt="" width="124" height="20" /></td> </tr> </table></td> </tr> <tr> <td align="center"> <jsp:include flush="true" page="tail.jsp"></jsp:include> </td> </tr> </table> </body> </html>
<%@ page language="java" import="java.util.*,com.xf.model.*" pageEncoding="utf-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; //得到用户信息session中取 UsersBean ub=(UsersBean)session.getAttribute("userInfo"); //得到购物车信息 ArrayList<GoodsBean> a1=(ArrayList<GoodsBean>)request.getAttribute("mycartInfo"); //得到购物车显示数量 MyCartBO mcb=(MyCartBO)session.getAttribute("mycart"); %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>My JSP 'shopping3.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <link rel="stylesheet" type="text/css" href="css/my.css"> </head> <body> <table width="82%" border="1" align="center"> <tr> <td align="center"> <jsp:include flush="true" page="head.jsp"></jsp:include> </td> </tr> <tr> <td align="center"><table width="100%" border="1"> <tr> <td align="center"><img src="images/web_development/shoppingcart.png" alt="" width="124" height="43" /><img src="images/web_development/arrow_next.png" alt="" width="124" height="43" /><img src="images/web_development/female.png" alt="" width="124" height="43" /><img src="images/web_development/arrow_next.png" alt="" width="124" height="43" /><img src="images/web_development/application.png" alt="" width="124" height="43" /><img src="images/web_development/arrow_next.png" alt="" width="124" height="43" /><img src="images/web_development/action_check.png" alt="" width="124" height="43" /></td> </tr> <tr> <td align="center"><table width="70%" border="1" class="abc"> <tr> <td colspan="2" align="center">购买人的信息</td> </tr> <tr> <td align="right">用 户 名:</td> <td align="left"><label for="textfield"></label> <input type="text" name="textfield" id="textfield" value="<%=ub.getUsername() %>" /></td> </tr> <tr> <td align="right">*真实姓名:</td> <td align="left"><input type="text" name="textfield2" id="textfield2" value="<%=ub.getTruename() %>" /></td> </tr> <tr> <td align="right">*家庭住址:</td> <td align="left"><input type="text" name="textfield3" id="textfield3" value="<%=ub.getAddress() %>" /></td> </tr> <tr> <td align="right">*联系电话:</td> <td align="left"><input type="text" name="textfield4" id="textfield4" value="<%=ub.getPhone() %>" /></td> </tr> <tr> <td align="right">*电子邮件:</td> <td align="left"><input type="text" name="textfield5" id="textfield5" value="<%=ub.getEmail() %>" /></td> </tr> <tr> <td align="right">*邮 编:</td> <td align="left"><input type="text" name="textfield6" id="textfield6" value="<%=ub.getPostcode() %>" /></td> </tr> <tr> <td align="right"><input type="submit" name="button" id="button" value="完成订单" /></td> <td align="left"><input type="submit" name="button2" id="button2" value="修改信息" /></td> </tr> </table></td> </tr> <tr> <td align="center"><table width="70%" border="1" class="abc"> <tr> <td colspan="4" align="center">我的购物车情况</td> </tr> <tr> <td align="center">编号</td> <td align="center">商品名称</td> <td align="center">单价</td> <td align="center">数量</td> </tr> <% for(int i=0 ; i != a1.size() ; ++i) { //取出GoodsBean GoodsBean gb=a1.get(i); %> <tr> <td align="center"><%=gb.getGoodsId() %></td> <td align="center"><%=gb.getGoodsName() %></td> <td align="center">¥<%=gb.getGoodsPrice() %></td> <td align="center"><%=mcb.getGoodsNumById(gb.getGoodsId()+"") %></td> </tr> <% } %> <tr> <td colspan="4">您一共选择了价值¥<%=mcb.getAllPrice() %>的商品</td> </tr> <tr> <td colspan="4" align="center"><input type="submit" name="button3" id="button3" value="返回修改我的购物车" /></td> </tr> </table></td> </tr> <tr> <td align="right"><img src="images/web_development/arrow_back.png" width="120" height="34" /><a href="OrderClServlet"><img border="0" src="images/web_development/arrow_next.png" width="120" height="34" /></a></td> </tr> </table></td> </tr> <tr> <td align="center"> <jsp:include flush="true" page="tail.jsp"></jsp:include> </td> </tr> </table> </body> </html>
<%@ page language="java" import="java.util.*,com.xf.model.*" pageEncoding="utf-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; //订单的详细信息取出来 OrderInfoBean oifb=(OrderInfoBean)request.getAttribute("detailbean"); %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>My JSP 'shopping4.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <link rel="stylesheet" type="text/css" href="css/my.css"> </head> <body> <table width="80%" border="1" align="center" class="abc"> <tr> <td align="center"> <jsp:include flush="true" page="head.jsp"></jsp:include> </td> </tr> <tr> <td><table width="100%" border="1"> <tr> <td colspan="9" align="center"><img src="images/web_development/shoppingcart.png" alt="" width="124" height="43" /><img src="images/web_development/arrow_next.png" alt="" width="124" height="43" /><img src="images/web_development/female.png" alt="" width="124" height="43" /><img src="images/web_development/arrow_next.png" alt="" width="124" height="43" /><img src="images/web_development/application.png" alt="" width="124" height="43" /><img src="images/web_development/arrow_next.png" alt="" width="124" height="43" /><img src="images/web_development/action_check.png" alt="" width="124" height="43" /></td> </tr> <tr> <td colspan="9" align="center">订单详细信息</td> </tr> <tr> <td align="center">订单号</td> <td align="center">收货人</td> <td align="center">收货地址</td> <td align="center">邮编</td> <td align="center">电话</td> <td align="center">总价</td> <td align="center">用户名</td> <td align="center">电子邮件</td> <td align="center"> </td> </tr> <tr> <td align="center"><%=oifb.getOrdersId() %></td> <td align="center"><%=oifb.getTruename() %></td> <td align="center"><%=oifb.getAddress() %></td> <td align="center"><%=oifb.getPostcode() %></td> <td align="center"><%=oifb.getPhone() %></td> <td align="center">¥<%=oifb.getTotalPrice() %></td> <td align="center"><%=oifb.getUsername() %></td> <td align="center"><%=oifb.getEmail() %></td> <td align="center"><a href="#">查看详情</a></td> </tr> <tr> <td colspan="9" align="center">您的订单已完成,服务器将在稍后时候向您的电子邮箱发送确认信息,并确定订单信息。</td> </tr> </table></td> </tr> <tr> <td align="center"> <jsp:include flush="true" page="tail.jsp"></jsp:include> </td> </tr> </table> </body> </html>
<%@ page language="java" import="java.util.*,com.xf.model.*" pageEncoding="utf-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; //取出要显示的数据 GoodsBean gb=(GoodsBean)request.getAttribute("goodsInfo"); %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>My JSP 'showDetail.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <link rel="stylesheet" type="text/css" href="css/my.css"> <!-- 加一段javascript的代码 --> <script type="text/javascript"> <!-- function returnHall() { //window.open跳转页面,后面的那个是限制不会出现新的窗口 window.open("index.jsp","_self"); } function addGoods(goodsId) { //向shoppingClServlet中添加货物 window.open("ShoppingClServlet?type=addGoods&goodsId="+goodsId,"_self"); } --> </script> </head> <table width="80%" border="1" align="center"> <tr> <td align="center"> <jsp:include flush="true" page="head.jsp"></jsp:include> </td> </tr> <tr> <td><table class="abc" width="100%" border="1"> <tr> <td height="23" colspan="2"> </td> </tr> <tr> <td width="19%" height="169" rowspan="8"><img src="images/<%=gb.getPhoto() %>" width="136" height="169" /></td> <td width="81%" align="center"><%=gb.getGoodsName() %></td> </tr> <tr> <td>价格:¥<%=gb.getGoodsPrice() %></td> </tr> <tr> <td> </td> </tr> <tr> <td>ISBN:<%=gb.getGoodsId() %></td> </tr> <tr> <td>类型:<%=gb.getType() %></td> </tr> <tr> <td>出版商:<%=gb.getPublisher() %></td> </tr> <tr> <td> </td> </tr> <tr> <td height="71"><%=gb.getGoodsIntro() %></td> </tr> <tr> <td colspan="2"><input type="submit" name="button" onclick="addGoods(<%=gb.getGoodsId() %>)" id="button" value="加入购物车" /> <input type="submit" name="button2" id="button2" onclick="return returnHall()" value="返回购物大厅" /></td> </tr> <tr> <td height="23" colspan="2"> </td> </tr> </table></td> </tr> <tr> <td align="center"> <jsp:include flush="true" page="tail.jsp"></jsp:include> </td> </tr> </table></html>
<%@ page language="java" import="java.util.*,com.xf.model.*" pageEncoding="utf-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; //得到传过来购物车的全部信息取出a1 ArrayList<GoodsBean> a1=(ArrayList)request.getAttribute("mycartinfo"); //得到mycartbo得到总价 MyCartBO mcbo=(MyCartBO)session.getAttribute("mycart"); %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>My JSP 'showMycart.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <link rel="stylesheet" type="text/css" href="css/my.css"> <script type="text/javascript"> <!-- //相应删除所有数据 function delAll() { window.open("ShoppingClServlet?type=delAll","_self"); } --> </script> </head> <body> <table class="css/my.css" width="80%" border="1" align="center"> <tr> <td align="center"> <jsp:include flush="true" page="head.jsp"></jsp:include> </td> </tr> <tr> <td align="center"> <form action="ShoppingClServlet?type=updateGoods" method="post"> <table width="100%" border="1"> <tr> <td height="23" colspan="4"><img src="images/web_development/shoppingcart.png" width="124" height="43" /><img src="images/web_development/arrow_next.png" width="124" height="43" /><img src="images/web_development/female.png" width="124" height="43" /><img src="images/web_development/arrow_next.png" alt="" width="124" height="43" /><img src="images/web_development/application.png" width="124" height="43" /><img src="images/web_development/arrow_next.png" alt="" width="124" height="43" /><img src="images/web_development/action_check.png" width="124" height="43" /></td> </tr> <tr> <td width="25%" align="center">编号</td> <td width="25%" align="center">名称</td> <td width="25%" align="center">单价</td> <td width="25%" align="center">数量</td> </tr> <% for(int i=0 ; i != a1.size() ; ++i) { //取出相应的数据 GoodsBean gb=a1.get(i); %> <tr> <td align="center"><%=gb.getGoodsId() %></td> <td align="center"><%=gb.getGoodsName() %></td> <td align="center">¥<%=gb.getGoodsPrice() %></td> <td align="center"><table width="100%" border="1"> <tr> <!-- 隐藏表单!!! --> <td width="33%"><input type="hidden" name="goodsId" value="<%=gb.getGoodsId() %>"><input name="newNums" type="text" id="textfield" size="10" value="<%=mcbo.getGoodsNumById(gb.getGoodsId()+"") %>" /></td> <td width="33%"><a href="ShoppingClServlet?type=delGoods&goodsId=<%=gb.getGoodsId() %>">删除</a></td> <td width="33%"><a href="showGoodsClServlet?type=showDetail&id=<%=gb.getGoodsId() %>">查看</a></td> </tr> </table></td> </tr> <% } %> <tr> <td> </td> <td align="center"><input onclick="delAll();" type="button" name="button1" id="button" value="删除全部书籍" /></td> <td align="center"><input type="submit" name="button2" id="button2" value="修改数量" /></td> <td> </td> </tr> <tr> <td colspan="4"> </td> </tr> </table> </form> <tr> <td colspan="4"><table width="100%" border="1"> <tr> <td width="50%">你选择了价值¥<%=mcbo.getAllPrice() %>的商品,点击<a href="index.jsp">此处</a>继续购物</td> <td width="50%" align="right"><a href="ShoppingCl2">下一步<img border="0" src="images/web_development/arrow_next.png" alt="" width="124" height="43" /></a></td> </tr> </table></td> </tr> </td> </tr> <tr> <td align="center"> <jsp:include flush="true" page="tail.jsp"></jsp:include> </td> </tr> </table> </body> </html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <table width="100%" border="0" align="center" class="abc"> <tr> <td align="center" bgcolor="#A4C6EC">合作伙伴:新浪 网易 百度 搜狐有</td> </tr> <tr> <td align="center">地址:中国湖北市*(有本事你咬我啊) 客服热线:110</td> </tr> <tr> <td align="center">邮箱:xiaofengbly@163.com 邮编:430023</td> </tr> <tr> <td align="center">copyright时尚购物yeah</td> </tr> </table>