手机在线销售系统代码.doc
长春工业大学人文信息学院毕业设计程序代码 姓名 _侯金莹_ 题目 _手机在线销售系统_ 系别 _计算机信息工程系_ 专业 _信息管理与信息系统_ 班级 _080613_ 指导教师 _郑山红_ 完成日期 _2012-5-27_目录1. login.jsp用户登录页面12. adminyanzheng.jsp用户验证43.dd_list2.jsp管理员查看客户订单64. dd_list.jsp 客户查看本人订单85. del.jsp 信息删除116. grzl.jsp 用户信息修改127. Hf.jsp 用户留言板148. index.jsp 手机在线销售主页169. Liuyanban.jsp 添加留言板1710.Prodetail.jsp 手机信息展示1911. shouji_add.jsp 手机信息添加页面2212. shouji_add.jsp 手机信息添加页面2513. userreg.jsp 用户注册页面2614. chakan.jsp 查看留言板信息2915. liuyanban_update.jsp 修改留言板信息3216. mod2.jsp 用户本人密码修改3317. mod.jsp 管理员修改用户密码3418. gwc.jsp 添加购物车3619.shouji_update.jsp 手机信息修改3820. youqinglianjie.jsp 添加友情链接40 长春工业大学人文信息学院 08061307 侯金莹 毕业设计程序代码1. login.jsp用户登录页面<% page language="java" pageEncoding="gb2312"%><%String path = request.getContextPath();String basePath = request.getScheme()+":/"+request.getServerName()+":"+request.getServerPort()+path+"/"%><% page language="java" import="java.sql.*" %><html> <head> <base href="<%=basePath%>"> <title>用户登录</title><style type="text/css"><!-body margin-left: 0px;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;overflow:hidden;background-color: #33FF00;.STYLE3 color: #528311; font-size: 12px; .STYLE4 color: #42870a;font-size: 12px;.STYLE5 color: #000066;font-size: 26pt;-></style> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head> <body style="BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none" bgColor=#366ab5 style="overflow:hidden"> <table width="102%"height="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td bgcolor="#e5f6cf"> </td> </tr> <tr> <td height="608" background="images/login_03.gif"><table width="862" border="0" align="center" cellpadding="0" cellspacing="0"> <tr><td height="266" background="images/login_04.gif"><table width="72%" height="51" border="0" align="center"> <tr><td><div style="font-family:宋体; color:#FFFFFF; filter:Glow(Color=#000000,Strength=2); WIDTH: 100%; FONT-WEIGHT: bold; FONT-SIZE: 19pt; margin-top:5pt"><div align="center" class="STYLE5">手机在线销售系统</div> </div></td> </tr> </table></td> </tr> <tr><td height="95"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr><td width="321" height="95" background="images/login_06.gif"> </td><td width="286" background="images/login_07.gif"><table width="95%" border="0" cellspacing="0" cellpadding="0"><form name="form1" method="post" action="adminyanzheng.jsp"><tr><td width="21%" height="30"><div align="center"><span class="STYLE3">用户</span></div></td><td width="79%" height="30"><input name="username" type="text" id="username" style="height:18px; width:130px; border:solid 1px #cadcb2; font-size:12px; color:#81b432;"><input name="login" type="hidden" id="login" value="1"></td></tr><tr><td height="30"><div align="center"><span class="STYLE3">密码</span></div></td><td height="30"><input name="pwd" type="password" id="pwd" style="height:18px; width:130px; border:solid 1px #cadcb2; font-size:12px; color:#81b432;"></td> </tr><tr><td height="30"> </td><td height="30"><input type="submit" name="Submit" value="登陆"><input type="reset" name="Submit2" value="重置"></td> </tr> </form> </table> </td><td width="255" background="images/login_08.gif"> </td> </tr> </table></td> </tr> <tr><td height="247" valign="top" background="images/login_09.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="22%" height="30"> </td> <td width="48%"> </td> <td width="30%"> </td> </tr> <tr> <td> </td><td height="30"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="44%" height="20"> </td><td width="56%" class="STYLE4">版本 <%java.util.Date date = new java.util.Date();/新建一个时间类datejava.text.SimpleDateFormat format = new java.text.SimpleDateFormat("yyyy-MM-dd",java.util.Locale.CHINA;/设置时间格式为年月日String result = format.format(date);out.print(result.substring(0,4);/截取字符串前四位 %> V1.0 </td> </tr> </table></td> <td> </td> </tr> </table></td> </tr> </table></td> </tr> <tr> <td bgcolor="#a2d962"> </td> </tr></table> </body></html>2. adminyanzheng.jsp用户验证<% page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %><!DOCTYPE html PUBLIC "-/W3C/DTD XHTML 1.0 Transitional/EN" "http:/www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http:/www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>手机在线销售系统</title><style type="text/css"><!-body background-color: #6699FF;-></style></head><body><% String username =request.getParameter("username ");/获取表单中文本框中的内容 String ps=request.getParameter("pwd "); if(username =""|ps="") /判断用户名或密码是否为空 out.print("<script>"); out.print("alert('用户名或密码不能为空!');");/若为空则系统提示信息 out.print("window.location.href='login.jsp'"); out.print("</script>"); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");/创建驱动器Connection con = DriverManager.getConnection("jdbc:odbc:mydb","sa","sa");/连接数据源mydb Statement stat = con.createStatement(); String sql = "select * from user where User_Name ='"+ username +"' and User_PWD ='"+ps+"'"/查询用户表 ResultSet rs = stat.executeQuery(sql);/将查询结果放在rs对象中 if(rs.next() session.setAttribute("username", User_Name);/将用户名放在session对象中response.sendRedirect("index.jsp"); /重定向到主页 else out.print("<script>"); out.print("alert('用户名或密码错误');"); out.print("window.location.href='login.jsp'"); out.print("</script>"); %></body></html>3.dd_list2.jsp管理员查看客户订单<% page language="java" pageEncoding="gb2312"%><%String path = request.getContextPath();String basePath = request.getScheme()+":/"+request.getServerName()+":"+request.getServerPort()+path+"/"%><% page language="java" import="java.sql.*" %><jsp:useBean id="connDbBean" scope="page" class="db.db"/><html> <head> <base href="<%=basePath%>"> <title>管理员查看客户订单</title> <LINK href="qtimages/CSS.css" type=text/css rel=stylesheet> </head><body > <p>所有客户的订单单列表:</p> <table width="100%" border="1" align="center" cellpadding="3" cellspacing="1" bordercolor="#00FFFF" style="border-collapse:collapse"> <tr> <td width="4%" bgcolor='#A4B6D7'>订单编号</td> <td width="8%" bgcolor='#A4B6D7'>订单名</td> <td width="18%" bgcolor='#A4B6D7'>订单状态</td> <td width="13%" bgcolor='#A4B6D7'>买家ID</td> <td width="6%" bgcolor="A4B6D7">订单生成称时间</td> <td width="18%" bgcolor="A4B6D7">交易完成时间</td> <td width="7%" bgcolor="A4B6D7">产品ID</td> <td width="8%" bgcolor="A4B6D7">价格</td> <td width="18%" bgcolor='#A4B6D7'>数量</td> <td width="13%" bgcolor='#A4B6D7'>邮费ID</td> <td width="6%" bgcolor="A4B6D7">收货人姓名</td> <td width="18%" bgcolor="A4B6D7">收货人电话</td> <td width="7%" bgcolor="A4B6D7">发货时间</td> </tr> <% String sql="" String id; sql="select orders.* from orders,user where 1=1 and user.User_ID=orders.user_id" sql=sql+" order by order_id desc"ResultSet RS_result=connDbBean.executeQuery(sql);id="" String order_id=""String order_name=""String tupia="" String user_name=""String start_time=""String finish_time=""String product_id="" String price=""String quantity=""String postage=""String post_mode=""String express="" String logistics=""String zip=""String name=""String phonepost_mode=""String delivery_time="" int i=0;while(RS_result.next() i=i+1;id=RS_result.getString("id");order_id=RS_result.getString("order_id");order_name=RS_result.getString("order_name");status=RS_result.getString("status");user_name=RS_result.getString("user_name");start_time=RS_result.getString("start_time");finish_timeRS_result.getString("finish_time");product_id=RS_result.getString("product_id"); pricer=RS_result.getString("price");quantity=RS_result.getString("quantity");postage=RS_result.getString("postage");post_mode=RS_result.getString("post_mode");express=RS_result.getString("express");logistics=RS_result.getString("logistics");zip=RS_result.getString("zip"); name=RS_result.getString("name");phone=RS_result.getString("phone");delivery_time=RS_result.getString("delivery_time");%> <tr> <td><%=order_id %></td> <td><%=order_name %></td> <td><%=status %></td> <td><%=user_name %></td> <td><%=start_time %></td> <td><%=finish_time %></td> <td><%=product_id %></td> <td><%=price %></td> <td><%=quantity %></td> <td><%=postage%></td> <td><%=post_mode%></td> <td><%=express%></td> <td><%=logistics%></td> <td><%=zip%></td> <td><%=name%></td> <td><%=phone%></td> <td><%=delivery_time%></td> <td><a href="del.jsp?id=<%=order_id %>&tablename=orders" onClick="return confirm('真的要删除?')">删除</a></td> </tr> <% %></table><br>以上数据共<%=i %>条,<a style="cursor:hand" onClick="javascript:window.print();">打印本页</a>/打印功能</body></html>4. dd_list.jsp 客户查看本人订单<% page language="java" pageEncoding="gb2312"%><%String path = request.getContextPath();String basePath = request.getScheme()+":/"+request.getServerName()+":"+request.getServerPort()+path+"/"%><% page language="java" import="java.sql.*" %><jsp:useBean id="connDbBean" scope="page" class="db.db"/><html> <head> <base href="<%=basePath%>"> <title>客户查看本人订单</title> <LINK href="qtimages/CSS.css" type=text/css rel=stylesheet> </head><body > <p>我的订单列表:</p> <table width="100%" border="1" align="center" cellpadding="3" cellspacing="1" bordercolor="#00FFFF" style="border-collapse:collapse"> <tr> <td width="4%" bgcolor='#A4B6D7'>订单编号</td> <td width="8%" bgcolor='#A4B6D7'>订单名</td> <td width="18%" bgcolor='#A4B6D7'>订单状态</td> <td width="13%" bgcolor='#A4B6D7'>买家ID</td> <td width="6%" bgcolor="A4B6D7">订单生成称时间</td> <td width="18%" bgcolor="A4B6D7">交易完成时间</td> <td width="7%" bgcolor="A4B6D7">产品ID</td> <td width="8%" bgcolor="A4B6D7">价格</td> <td width="18%" bgcolor='#A4B6D7'>数量</td> <td width="13%" bgcolor='#A4B6D7'>邮费ID</td> <td width="6%" bgcolor="A4B6D7">收货人姓名</td> <td width="18%" bgcolor="A4B6D7">收货人电话</td> <td width="7%" bgcolor="A4B6D7">发货时间</td> </tr> <% String sql="" String id;sql="select orders.* from orders,user where username='"+request.getSession().getAttribute("username")+"'" sql=sql+" order by id desc"/按id进行降序排列ResultSet RS_result=connDbBean.executeQuery(sql);id=""String order_id=""String user_name=""String start_time=""String finish_time=""String product_id="" String price=""String quantity=""String postage=""String post_mode=""String express="" String logistics=""String zip=""String name=""String phonepost_mode=""String delivery_time="" int i=0; int i=0; while(RS_result.next() i=i+1; id=RS_result.getString("id");order_id=RS_result.getString("order_id");order_name=RS_result.getString("order_name");status=RS_result.getString("status");user_name=RS_result.getString("user_name");start_time=RS_result.getString("start_time");finish_timeRS_result.getString("finish_time");product_id=RS_result.getString("product_id"); pricer=RS_result.getString("price");quantity=RS_result.getString("quantity");postage=RS_result.getString("postage");post_mode=RS_result.getString("post_mode");express=RS_result.getString("express");logistics=RS_result.getString("logistics");zip=RS_result.getString("zip"); name=RS_result.getString("name");phone=RS_result.getString("phone");delivery_time=RS_result.getString("delivery_time");%> <tr> <td><%=order_id %></td> <td><%=order_name %></td> <td><%=status %></td> <td><%=user_name %></td> <td><%=start_time %></td> <td><%=finish_time %></td> <td><%=product_id %></td> <td><%=price %></td> <td><%=quantity %></td> <td><%=postage%></td> <td><%=post_mode%></td> <td><%=express%></td> <td><%=logistics%></td> <td><%=zip%></td> <td><%=name%></td> <td><%=phone%></td> <td><%=delivery_time%></td> <td><a href="del.jsp?id=<%=order_id %>&tablename=orders" onClick="return confirm('真的要删除?')">删除</a></td> </tr> <% %></table><br>以上数据共<%=i %>条,<a style="cursor:hand" onClick="javascript:window.print();">打印本页</a></body></html>5. del.jsp 信息删除<% page language="java" pageEncoding="gb2312"%><%String path = request.getContextPath();String basePath = request.getScheme()+":/"+request.getServerName()+":"+request.getServerPort()+path+"/"%><% page language="java" import="java.sql.*" %><jsp:useBean id="connDbBean" scope="page" class="db.db"/><!DOCTYPE HTML PUBLIC "-/W3C/DTD HTML 4.01 Transitional/EN"><html> <head> <base href="<%=basePath%>"> <title>My JSP 'adminyanzheng.jsp' starting page</title> </head> <body> <%String id=request.getParameter("id");String tablename=request.getParameter("tablename");String sql="delete from "+tablename+" where id="+id+"" connDbBean.executeUpdate(sql);out.print("<script>alert('删除成功!');location.href='"+request.getHeader("Referer")+"'</script>"); %> </body></html>6. grzl.jsp 用户信息修改<% page language="java" pageEncoding="gb2312"%><%String path = request.getContextPath();String basePath = request.getScheme()+":/"+request.getServerName()+":"+request.getServerPort()+path+"/"%><% page language="java" import="java.sql.*" %><jsp:useBean id="connDbBean" scope="page" class="db.db"/><html> <head> <base href="<%=basePath%>"> <title>手机在线销售系统</title> <script language="javascript" src="js/Calendar.js"></script> </head> <% String id=request.getParameter("id"); %> <body ><form name="form1" id="form1" method="post" action="yonghuzhuce_updt_post.jsp"> 修改个人资料: <br><br> <% String sql="select * from user