管理学院电子商务专业
网上营销设计
(20##—20##学年)
设计名称:OnlyShirt网上商城系统实施报告
班 级:
姓 名:
指导教师:
成 绩:
地 点:经管院实验室
序 号:
20##年6月22日
目 录
1.项目概述……………………………………………………………………4
2.系统分析……………………………………………………………………4
2.1 系统目标需求……………………………………………………………4
2.2 可行性分析………………………………………………………………4
2.3 流程分析…………………………………………………………………4
2.4 数据流程分析……………………………………………………………6
3.系统设计……………………………………………………………………7
3.1 平台设计…………………………………………………………………7
3.2 系统总体结构设计………………………………………………………7
3.2.1功能结构图………………………………………………………………7
3.3 代码设计简介……………………………………………………………9
3.4信息输入与输出设计……………………………………………………9
3.4.1 用户注册界面…………………………………………………………9
3.4.2 用户登录界面…………………………………………………………9
3.4.3 留言中心界面…………………………………………………………10
3.5 数据库界面………………………………………………………………11
4.系统实施部分………………………………………………………………12
4.1 源程序代码…………………………………………………………………12
4.2数据库代码…………………………………………………………………43
5.开发总结………………………………………………………………………54
6.附录……………………………………………………………………………54
1 项目概述
OnlyShirt是基于互联网的一个电子商务网站,现在卖个性T恤、衬衫的网站有很多,但是我们的想法是用团购的方式来出售,每天上线一款新的T恤或小样,用户可以在网上下单买下这款,而在一天后会立即下线,如此一来,顾客从我们网站上买到的T恤都是绝版,T恤售价和市场普通T恤一样,这样使每个顾客都掏得出钱购买它,T恤的设计由商家或设计师给出,设计师每卖一件T恤他们就可以从中拿到10%的销售提成,或者他们有成品或库存、并负责物流,我们网站平台收取10%的销售提成;消费者在线预订,网站会在7天左右的时间制作出T恤,并打包送至消费者手中。
2 系统分析
2.1 系统目标需求
网上商城采用的是B2C模式,通过对一些典型的B2C网站的分析,得到以下几个建站标准:
1.网页设计,符合大众审美,并有艺术感的亮点存在,能在第一时间内给潜在客户留下印象。
2.用户体验。专注于怎样让用户搜索、比较、流程更便捷,获得良好的用户体验。
3.内容。探寻客户的潜在需求,为潜在客户提供最有价值的信息,引导和教育客户怎样去选择和鉴定商品,并且让客户相信这些信息及服务足够让他们付诸行动购买,提供最具商业价值的网站结构布局。
4.搜索引擎优化。网站优化,正确运用各种设计元素,让搜索引擎更易抓取,提升网站的营销价值。
2.2 可行性分析
系统的开发采用Dreamwear,JSP技术,MySQL数据库等。这些程序设计工具和技术都比较常用,对于系统功能的实现起到主要作用。Web服务器在遇到访问JSP网页的请求时,首先执行其中的程序段,然后将执行结果连同JSP文件中的HTML代码一起返回给客户。插入的Java程序段可以操作数据库、重新定向网页等,以实现建立动态网页所需要的功能。
2.3 流程分析
主要业务流程图如下图所示:
2.4 数据流程分析
系统数据流程图
3 系统设计
3.1 平台设计
表3-1 系统平台设计
3.2 系统总体结构设计
3.2.1 功能结构图
3.3 代码设计简介
在开发系统的过程中,我们对订单编号进行了设计,为使订单编号实现系统自动编码,编码采用层次码加顺序码,层次码表示年、月、日,省份等一些信息,顺序码则表示订单形成的先后次序。而通过下拉菜单,实现了选择配送地址。留言代码设计等。
3.4 信息输入与输出设计
信息的输入与输出所完成的功能是将机外或外地机的信息转换成机内信息,它是对信息进行处理的出发点,是信息处理的“源”,因此保证这个“源”的正确性是输入设计中的一项重要的内容。如果输入的数据有误,即使计算和处理十分的正确,也无法获得可靠的信息。而输出设计是系统实现业务、管理功能所不可或缺的部分。输出信息的使用者是用户,所以输出的内容与格式等是用户比较关心的问题。网站中主要的输入部分包括:用户登录,用户注册,收银台界面等而输出的则是相应的处理结果信息。
3.4.1 网站主页界面
3.4.2 用户注册界面
3.4.3 留言中心界面
3.4.4 订单提交界面
3.5 数据库界面
用户信息user表:
留言信息messages表:
订单信息houtai表:
4 系统实施部分
4.1 源程序代码
4.1.1 数据库代码
网站主页:index.jsp
<%@ page contentType="text/html; charset=utf-8" 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=utf-8" />
<title>Only Shirt</title>
<script language="javascript">
<!--
function check(){
if(document.form1.username.value==""){
alert("用户名不能为空!");
form1.username.focus();
return false;
}
if(document.form1.password.value==""){
alert("标题不能为空!");
form1.password.focus();
return false;
}
else
return true;}
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<style type="text/css">
<!--
.STYLE3 {
font-family: "新宋体";
color: #993333;
font-size: 12px;
}
.STYLE4 {
color: #FF3333;
font-weight: bold;
font-size: 12pt;
}
.STYLE5 {color: #FF0000}
.body-tab {
border: thin solid #99CC99;
font-size: 9pt;
}
.STYLE6 {
font-size: 16pt;
font-weight: bold;
color: #FF0000;
}
.STYLE10 {font-size: 18pt; font-weight: bold; color: #6666FF; }
.STYLE12 {color: #993366}
.STYLE14 {color: #0099FF}
.STYLE15 {
font-family: Arial, Helvetica, sans-serif;
font-size: 10pt;
}
.STYLE16 {color: #3366FF}
-->
</style>
</head>
<body bgcolor="" topmargin="0" class="" onload="MM_preloadImages('images/04.jpg')">
<table width="75%" border="0" align="center" class="body-tab">
<tr><td height="568">
<form id="form1" name="form1" method="post" action="login.jsp">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center" nowrap="nowrap"><div align="center"><span class="STYLE3">您好,欢迎光临 </span><span class="STYLE4">Only Shirt!</span></div></td>
<td align="right" nowrap="nowrap"><span class="STYLE5">用户名</span>
<label>
<input name="username" type="text" size="25" />
</label></td>
<td align="center" nowrap="nowrap"><span class="STYLE5">密 码</span>
<label>
<input name="password" type="password" size="25" />
</label></td>
<td align="center" nowrap="nowrap"><label>
<input type="submit" name="Submit" value="登录" />
</label></td>
<td align="center" nowrap="nowrap"><a href="yonghuzhuce.jsp" target="_self">注册</a></td>
</tr>
</table>
</form>
<table width="100%" height="98" align="center" cellpadding="0" cellspacing="0">
<tr><td width="25%" rowspan="2"><img src="images/logo.jpg" width="213" height="85" align="right" /></td>
<td width="29%" rowspan="2"><img src="images/5.jpg" width="147" height="63" /></td>
<td width="46%" height="33" align="right"><label>
<input type="radio" name="radiobutton" value="radiobutton" />
搜全站
<input type="radio" name="radiobutton" value="radiobutton" />
搜VT
<input type="text" name="textfield3" />
<a href="#">搜索</a><a href="#"></a></label></td>
</tr>
<tr>
<td height="24" align="right">热门关键词:可爱 休闲 复古 名族风</td>
</tr>
<tr>
<td height="11" colspan="3"><img src="images/6.jpg" width="100%" height="11" /></td>
</tr>
</table>
<table width="99%" height="428" align="center" cellpadding="0" cellspacing="0">
<tr><td height="426" nowrap="nowrap">
<table width="716" height="426" border="0" align="center">
<tr>
<td width="710" height="422"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image11','','images/04.jpg',1)"><img src="images/01.jpg" name="Image11" width="710" height="420" border="0" id="Image11" /></a></td>
</tr>
</table>
</td>
<td nowrap="nowrap"><table width="145" height="343" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2" align="center"><h2><a href="liuyanzhongxin.jsp">留言</a></h2></td>
</tr>
<tr>
<td width="71" align="right">价格:</td>
<td width="112" align="center"><span class="STYLE6">198¥</span></td>
</tr>
<tr>
<td align="right">运费:</td>
<td align="center"><label>
<select name="select" size="1">
<option>快递 10¥</option>
<option>平邮 15¥</option>
<option>EMS 20¥</option>
</select>
<span class="STYLE2"></span></label></td>
</tr>
<tr>
<td align="right">配送:</td>
<td align="center"><label>
<select name="select" size="1">
<option>湖北</option>
<option>江苏</option>
<option>四川</option>
<option>广东</option>
<option>河南</option>
<option>吉林</option>
<option>辽宁</option>
<option>黑龙江</option>
<option>陕西</option>
<option>山西</option>
<option>河北</option>
<option>内蒙古</option>
<option>山东</option>
<option>安徽</option>
<option>福建</option>
<option>浙江</option>
<option>湖南</option>
<option>江西</option>
<option>甘肃</option>
<option>贵州</option>
<option>云南</option>
<option>宁夏</option>
<option>青海</option>
<option>广西</option>
<option>西藏</option>
<option>新疆</option>
</select>
省
<select name="y" id="y">
<option>武汉</option>
<option>孝感</option>
<option>黄石</option>
<option>咸宁</option>
<option>恩施</option>
</select>
市
<span class=""></span></label></td>
</tr>
<tr>
<td rowspan="3" align="right">评价:</td>
<td align="center"><label>
<input type="radio" name="radiobutton" value="radiobutton" />
<span class="STYLE5">很好</span></label></td>
</tr>
<tr>
<td align="center"><label>
<input type="radio" name="radiobutton" value="radiobutton" />
<span class="STYLE12">较好</span></label></td>
</tr>
<tr>
<td align="center"><label>
<input type="radio" name="radiobutton" value="radiobutton" />
<span class="STYLE14">较差</span></label></td>
</tr>
<tr align="right">
<td colspan="2" align="center"><h5><a href="#"></a><img src="images/e.png" width="136" height="34" /> <a href="shouyintai.jsp" class="STYLE15">去支付</a></h5></td>
</tr>
</table></td>
</tr>
</table>
</td>
</tr>
</table>
<table width="75%" border="0" align="center" class="body-tab" cellpadding="2" cellspacing="2">
<tr><td>
<table width="100%" height="75" align="center">
<tr>
<td colspan="5" align="center" nowrap="nowrap"><span class="STYLE10">友情链接</span></td>
</tr>
<tr>
<td align="center" nowrap="nowrap"><a href="http://www.vancl.com">凡客诚品</a></td>
<td align="center" nowrap="nowrap"><a href="http://www.vancl.com">淘宝网</a></td>
<td align="center" nowrap="nowrap"><a href="http://www.vancl.com">当当网</a></td>
<td align="center" nowrap="nowrap"><a href="http://www.vancl.com">拍拍网</a></td>
<td align="center" nowrap="nowrap"><a href="http://www.vancl.com">京东商城</a></td>
</tr>
<tr>
<td align="center" nowrap="nowrap"><a href="http://www.vancl.com">麦考林</a></td>
<td align="center" nowrap="nowrap"><a href="http://www.vancl.com">苏凌易购</a></td>
<td align="center" nowrap="nowrap"><a href="http://www.vancl.com">亚马逊</a></td>
<td align="center" nowrap="nowrap"><a href="http://www.vancl.com">唯品会</a></td>
<td align="center" nowrap="nowrap"><a href="http://baidu.com">阿里巴巴</a></td>
</tr></table>
</td>
</tr>
</table>
<table width="75%" border="0" align="center" class="body-tab">
<tr><td>
<table width="100%" height="126" align="center">
<tr align="center">
<td height="30" colspan="6"><div>
<p class="STYLE16">Copyright 20## - 20## onlyshirt.com All Rights Reserved 京ICP证100557号 武汉纺织大学电子商务103</p>
<p class="STYLE16"> 出版物经营许可证新出发京批字第直110138号</p>
</div></td>
</tr>
<tr align="center">
<td><img src="images/5.jpg" width="111" height="57" /> </td>
<td><img src="images/a.png" width="135" height="64" /></td>
<td><img src="images/b.png" width="177" height="67" /></td>
<td><img src="images/c.png" width="103" height="58" /></td>
<td><img src="images/d.png" width="111" height="57" /></td>
<td><img src="images/5.jpg" width="111" height="57" /></td>
</tr></table>
</td>
</tr>
</table>
</body>
</html>
用户注册界面:yonghuzhuce.jsp
<%@ page contentType="text/html; charset=utf-8" 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=utf-8" />
<title>Only Shirt</title>
<script language="javascript">
<!--
function check(){
if(document.form1.username.value==""){
alert("用户名不能为空!");
form1.username.focus();
return false;
}
if(document.form1.password.value==""){
alert("标题不能为空!");
form1.password.focus();
return false;
}
else
return true;}
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<style type="text/css">
<!--
.STYLE3 {
font-family: "新宋体";
color: #993333;
font-size: 12px;
}
.STYLE4 {
color: #FF3333;
font-weight: bold;
font-size: 12pt;
}
.STYLE5 {color: #FF0000}
.body-tab {
border: thin solid #99CC99;
font-size: 9pt;
}
.STYLE6 {
font-size: 16pt;
font-weight: bold;
color: #FF0000;
}
.STYLE10 {font-size: 18pt; font-weight: bold; color: #6666FF; }
.STYLE12 {color: #993366}
.STYLE14 {color: #0099FF}
.STYLE15 {
font-family: Arial, Helvetica, sans-serif;
font-size: 10pt;
}
.STYLE16 {color: #3366FF}
-->
</style>
</head>
<body bgcolor="" topmargin="0" class="" onload="MM_preloadImages('images/04.jpg')">
<table width="75%" border="0" align="center" class="body-tab">
<tr><td height="568">
<form id="form1" name="form1" method="post" action="login.jsp">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center" nowrap="nowrap"><div align="center"><span class="STYLE3">您好,欢迎光临 </span><span class="STYLE4">Only Shirt!</span></div></td>
<td align="right" nowrap="nowrap"><span class="STYLE5">用户名</span>
<label>
<input name="username" type="text" size="25" />
</label></td>
<td align="center" nowrap="nowrap"><span class="STYLE5">密 码</span>
<label>
<input name="password" type="password" size="25" />
</label></td>
<td align="center" nowrap="nowrap"><label>
<input type="submit" name="Submit" value="登录" />
</label></td>
<td align="center" nowrap="nowrap"><a href="yonghuzhuce.jsp" target="_self">注册</a></td>
</tr>
</table>
</form>
<table width="100%" height="98" align="center" cellpadding="0" cellspacing="0">
<tr><td width="25%" rowspan="2"><img src="images/logo.jpg" width="213" height="85" align="right" /></td>
<td width="29%" rowspan="2"><img src="images/5.jpg" width="147" height="63" /></td>
<td width="46%" height="33" align="right"><label>
<input type="radio" name="radiobutton" value="radiobutton" />
搜全站
<input type="radio" name="radiobutton" value="radiobutton" />
搜VT
<input type="text" name="textfield3" />
<a href="#">搜索</a><a href="#"></a></label></td>
</tr>
<tr>
<td height="24" align="right">热门关键词:可爱 休闲 复古 名族风</td>
</tr>
<tr>
<td height="11" colspan="3"><img src="images/6.jpg" width="100%" height="11" /></td>
</tr>
</table>
<table width="99%" height="428" align="center" cellpadding="0" cellspacing="0">
<tr><td height="426" nowrap="nowrap">
<table width="716" height="426" border="0" align="center">
<tr>
<td width="710" height="422"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image11','','images/04.jpg',1)"><img src="images/01.jpg" name="Image11" width="710" height="420" border="0" id="Image11" /></a></td>
</tr>
</table>
</td>
<td nowrap="nowrap"><table width="145" height="343" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2" align="center"><h2><a href="liuyanzhongxin.jsp">留言</a></h2></td>
</tr>
<tr>
<td width="71" align="right">价格:</td>
<td width="112" align="center"><span class="STYLE6">198¥</span></td>
</tr>
<tr>
<td align="right">运费:</td>
<td align="center"><label>
<select name="select" size="1">
<option>快递 10¥</option>
<option>平邮 15¥</option>
<option>EMS 20¥</option>
</select>
<span class="STYLE2"></span></label></td>
</tr>
<tr>
<td align="right">配送:</td>
<td align="center"><label>
<select name="select" size="1">
<option>湖北</option>
<option>江苏</option>
<option>四川</option>
<option>广东</option>
<option>河南</option>
<option>吉林</option>
<option>辽宁</option>
<option>黑龙江</option>
<option>陕西</option>
<option>山西</option>
<option>河北</option>
<option>内蒙古</option>
<option>山东</option>
<option>安徽</option>
<option>福建</option>
<option>浙江</option>
<option>湖南</option>
<option>江西</option>
<option>甘肃</option>
<option>贵州</option>
<option>云南</option>
<option>宁夏</option>
<option>青海</option>
<option>广西</option>
<option>西藏</option>
<option>新疆</option>
</select>
省
<select name="y" id="y">
<option>武汉</option>
<option>孝感</option>
<option>黄石</option>
<option>咸宁</option>
<option>恩施</option
</select>
市
<span class=""></span></label></td>
</tr>
<tr>
<td rowspan="3" align="right">评价:</td>
<td align="center"><label>
<input type="radio" name="radiobutton" value="radiobutton" />
<span class="STYLE5">很好</span></label></td>
</tr>
<tr>
<td align="center"><label>
<input type="radio" name="radiobutton" value="radiobutton" />
<span class="STYLE12">较好</span></label></td>
</tr>
<tr>
<td align="center"><label>
<input type="radio" name="radiobutton" value="radiobutton" />
<span class="STYLE14">较差</span></label></td>
</tr>
<tr align="right">
<td colspan="2" align="center"><h5><a href="#"></a><img src="images/e.png" width="136" height="34" /> <a href="shouyintai.jsp" class="STYLE15">去支付</a></h5></td>
</tr>
</table></td>
</tr>
</table>
</td>
</tr>
</table>
<table width="75%" border="0" align="center" class="body-tab" cellpadding="2" cellspacing="2">
<tr><td>
<table width="100%" height="75" align="center">
<tr>
<td colspan="5" align="center" nowrap="nowrap"><span class="STYLE10">友情链接</span></td>
</tr>
<tr>
<td align="center" nowrap="nowrap"><a href="http://www.vancl.com">凡客诚品</a></td>
<td align="center" nowrap="nowrap"><a href="http://www.vancl.com">淘宝网</a></td>
<td align="center" nowrap="nowrap"><a href="http://www.vancl.com">当当网</a></td>
<td align="center" nowrap="nowrap"><a href="http://www.vancl.com">拍拍网</a></td>
<td align="center" nowrap="nowrap"><a href="http://www.vancl.com">京东商城</a></td>
</tr>
<tr>
<td align="center" nowrap="nowrap"><a href="http://www.vancl.com">麦考林</a></td>
<td align="center" nowrap="nowrap"><a href="http://www.vancl.com">苏凌易购</a></td>
<td align="center" nowrap="nowrap"><a href="http://www.vancl.com">亚马逊</a></td>
<td align="center" nowrap="nowrap"><a href="http://www.vancl.com">唯品会</a></td>
<td align="center" nowrap="nowrap"><a href="http://baidu.com">阿里巴巴</a></td>
</tr></table>
</td>
</tr>
</table>
<table width="75%" border="0" align="center" class="body-tab">
<tr><td>
<table width="100%" height="126" align="center">
<tr align="center">
<td height="30" colspan="6"><div>
<p class="STYLE16">Copyright 20## - 20## onlyshirt.com All Rights Reserved 京ICP证100557号 武汉纺织大学电子商务103</p>
<p class="STYLE16"> 出版物经营许可证新出发京批字第直110138号</p>
</div></td>
</tr>
<tr align="center">
<td><img src="images/5.jpg" width="111" height="57" /> </td>
<td><img src="images/a.png" width="135" height="64" /></td>
<td><img src="images/b.png" width="177" height="67" /></td>
<td><img src="images/c.png" width="103" height="58" /></td>
<td><img src="images/d.png" width="111" height="57" /></td>
<td><img src="images/5.jpg" width="111" height="57" /></td>
</tr></table>
</td>
</tr>
</table>
</body>
</html>
留言中心界面:liuyanzhongxin.jsp
<%@ page contentType="text/html; charset=utf-8" 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=utf-8" />
<script language="javascript">
function check(){
if(document.form1.yonghuming.value==""){
alert("用户名不能为空!");
form1.yonghuming.focus();
return false;
}
if(document.form1.biaoti.value==""){
alert("标题不能为空!");
form1.biaoti.focus();
return false;
}
if(document.form1.liuyan.value==""){
alert("留言内容不能为空!");
form1.liuyan.focus();
return false;
}
else
return true;}
</script>
<style type="text/css">
<!--
.body-ta {
border: thin solid #99CC99;
font-size: 9pt;
}
.qq {
background-color: #C2E3EC;
}
.STYLE18 {
font-size: x-large;
font-weight: bold;
}
-->
</style>
<title>留言中心</title>
</head>
<body bgcolor="#70BEE5">
<table width="65%" height="650" border="0" align="center" background="images/img99.jpg" class="body-ta">
<tr><td>
<form id="form1" name="form1" method="post" action="liuyanban.jsp" onsubmit="return check()"><table border="0" align="left">
<tr><td width="553">
<table width="413" border="0" align="center">
<tr>
<td colspan="2" align="center"><h1> </h1></td>
<td align="left"><span class="STYLE18">留言板</span></td>
</tr>
<tr>
<td width="10" align="center"> </td>
<td width="66" align="left">用户名:</td>
<td width="323"><label>
<input name="yonghuming" type="yonghuming" class="qq" maxlength="16"/>
</label></td>
</tr>
<tr>
<td align="center"> </td>
<td align="left">性 别:</td>
<td><label>
<input name="xingbie" type="xingbie" class="qq" size="2"/>
</label></td>
</tr>
<tr>
<td align="center"> </td>
<td align="left">标 题:</td>
<td><label>
<input name="biaoti" type="biaoti" class="qq" maxlength="20"/>
</label></td>
</tr>
<tr>
<td align="center"> </td>
<td align="center"> </td>
<td> </td>
</tr>
<tr>
<td align="center"><label></label></td>
<td colspan="2" align="left">留言内容:</td>
</tr>
<tr>
<td align="center"> </td>
<td colspan="2" align="left"><label></label> <textarea name="liuyan" cols="45" rows="8" class="qq"></textarea></td>
</tr>
<tr>
<td align="right"> </td>
<td align="right"><label></label><label></label></td>
<td align="center"><label>
<input name="Submit" type="submit" class="qq" value="提交" />
</label>
<label>
<input name="Submit2" type="reset" class="qq" value="取消" />
</label></td>
</tr>
</table>
</td>
</tr></table>
</form>
</td></tr></table
></body>
</html>
商品订单界面:dingdan.jsp
<%@ page contentType="text/html; charset=utf-8" 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=utf-8" />
<script language="javascript">
function check(){
if (document.form1.name.value==""){
alert("用户名不能为空!");
form1.name.focus();
return false;
}
if (document.form1.address.value==""){
alert("地址不能为空!");
form1.address.focus();
return false;
}
if (document.form1.postcode.value==""){
alert("邮编不能为空!");
form1.postcode.focus();
return false;
}
if (document.form1.tel.value==""){
alert("电话不能为空!");
form1.tel.focus();
return false;
}
else
return true;}
</script>
<style type="text/css">
<!--
.STYLE1 {color: #FF0000}
-->
</style>
<head>
<title>商品订单</title>
</head>
<body background="images/img86.jpg">
<table width="745" height="70" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center" bgcolor=""> </td>
</tr>
<tr>
<td align="center" bgcolor=""> </td>
</tr>
<tr>
<td align="center" bgcolor=""> </td>
</tr>
<tr>
<td align="center" bgcolor=""> </td>
</tr>
<tr>
<td align="center" bgcolor=""> </td>
</tr>
<tr>
<td align="center" bgcolor=""><h1>商 品 订 单</h1></td>
</tr>
<tr>
<td align="center" bgcolor=""> </td>
</tr>
<tr>
<td align="center" bgcolor=""> </td>
</tr>
<tr>
<td align="center">请 填 写 收 货 人 的 有 关 信 息</td>
</tr>
<tr>
<td align="center"><span class="STYLE1">(其 中 带 * 号 的 是 必 填 的 内 容)</span></td>
</tr>
</table>
<form id="form1" name="form1" method="post" action="shouyinhoutai.jsp" onsubmit="check()">
<p> 收货人姓名:
<input name="name" type="text" id="name" maxlength="16" />
*
</p>
<p> 收货人地址:
<input name="address" type="text" id="address" size="60" maxlength="60" />
*</p>
<p> 收货人邮编:
<input name="postcode" type="text" id="postcode" maxlength="6" />
*</p>
<p> 收货人电话:
<input name="tel" type="text" id="tel" maxlength="15" />
*</p>
<p> 付款方式:
<input name="radiobutton" type="radio" value="radiobutton" checked="checked" />
货到付款
<input type="radio" name="radiobutton" value="radiobutton" />
网银付款
<input type="radio" name="radiobutton" value="radiobutton" />
汇款</p>
<p> 备注/留言:
<textarea name="beizhu" cols="40" rows="4" id="beizhu"></textarea>
</p>
<p>
<input name="tjdd" type="submit" id="tjdd" value="提交订单" />
<input name="cxtx" type="reset" id="cxtx" value="重新填写" />
</p>
</form>
</body>
</html>
4.2 数据库代码
用户登录:login.jsp
<%@ page contentType="text/html; charset=utf-8" 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=utf-8" />
<title>用户登录</title>
<style type="text/css">
<!--
.q {
font-family: "宋体";
font-size: 12pt;
font-weight: bold;
color: #FF0000;
}
-->
</style>
</head>
<body>
<%
request.setCharacterEncoding("utf-8");
// 获取表单所有字段信息
String a=request.getParameter("username");
String b=request.getParameter("password");
//链接数据库
Connection myconn=null;
Class.forName("org.gjt.mm.mysql.Driver");
myconn=DriverManager.getConnection("jdbc:mysql://localhost/test1","root","520");
String sql="select * from user where name=? and pwd1=? ";
PreparedStatement rsp=myconn.prepareStatement(sql);
rsp.setString(1,a);
rsp.setString(2,b);
ResultSet rs=rsp.executeQuery();
if(rs.next())
{
response.sendRedirect("index.jsp");
myconn.close();
}
else
{
out.print("密码或用户名不正确请注册或者重新输入");
}
%>
</body>
<META HTTP-EQUIV=REFRESH CONTENT="4;URL=index.jsp">
本页面将在<span id=yu class="q">5</span><a href=javascript:countDown></a>秒后自动返回
<script>
function countDown(secs){
yu.innerText=secs;
if(--secs>0){
setTimeout("countDown("+secs+")",1000);
}
}
countDown(5);
</script>
</html>
用户信息:yonghuxinxi.jsp
<%@ page contentType="text/html; charset=utf-8" 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=utf-8" />
<style type="text/css">
<!--
.q {
font-size: 12pt;
font-weight: bold;
color: #FF0000;
}
-->
</style>
<title>用户信息</title>
</head>
<body class="">
<%
request.setCharacterEncoding("utf-8");
// 获取表单所有字段信息
String a=request.getParameter("yhm");
String b=request.getParameter("mm1");
String c=request.getParameter("mm2");
String d=request.getParameter("em");
String e=request.getParameter("zsxm");
//链接数据库
Connection myconn=null;
Class.forName("org.gjt.mm.mysql.Driver");
myconn=DriverManager.getConnection("jdbc:mysql://localhost/test1","root","520");
String sql="insert into user(name,pwd1,pwd2,em,zsxm) values(?,?,?,?,?) ";
PreparedStatement rsp=myconn.prepareStatement(sql);
rsp.setString(1,a);
rsp.setString(2,b);
rsp.setString(3,c);
rsp.setString(4,d);
rsp.setString(5,e);
rsp.executeUpdate();
myconn.close();
out.print("恭喜你已经成功注册!");
%>
</body>
<META HTTP-EQUIV=REFRESH CONTENT="4;URL=index.jsp">
本页面将在<span id=yu class="q">5</span><a href=javascript:countDown></a>秒后自动返回
<script>
function countDown(secs){
yu.innerText=secs;
if(--secs>0){
setTimeout("countDown("+secs+")",1000);
}
}
countDown(5);
</script>
</html>
订单管理:dingdan.jsp
<%@ page contentType="text/html; charset=utf-8" 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=utf-8" />
<title>订单管理</title>
<style type="text/css">
<!--
.q {
font-family: "宋体";
font-size: 12pt;
font-weight: bold;
color: #FF0000;
}
-->
</style>
</head>
<body>
<%
request.setCharacterEncoding("utf-8");
// 获取表单所有字段信息
String a=request.getParameter("name");
String b=request.getParameter("address");
String c=request.getParameter("postcode");
String d=request.getParameter("tel");
String e=request.getParameter("beizhu");
//链接数据库
Connection myconn=null;
Class.forName("org.gjt.mm.mysql.Driver");
myconn=DriverManager.getConnection("jdbc:mysql://localhost/test1","root","520");
String sql="insert into houtai(xingming,dizhi,youbian,dianhua,beizhu) values(?,?,?,?,?) ";
PreparedStatement rsp=myconn.prepareStatement(sql);
rsp.setString(1,a);
rsp.setString(2,b);
rsp.setString(3,c);
rsp.setString(4,d);
rsp.setString(5,e);
rsp.executeUpdate();
myconn.close();
out.print("恭喜您已经成功提交订单!");
%>
</body>
<META HTTP-EQUIV=REFRESH CONTENT="4;URL=index.jsp">
本页面将在<span id=yu class="q">5</span><a href=javascript:countDown></a>秒后自动返回
<script>
function countDown(secs){
yu.innerText=secs;
if(--secs>0){
setTimeout("countDown("+secs+")",1000);
}
}
countDown(5);
</script>
</html>
留言管理:liuyanban.jsp
<%@ page contentType="text/html; charset=utf-8" 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=utf-8" />
<title>留言管理</title>
</head>
<style type="text/css">
<!--
.q {
font-family: "宋体";
font-size: 12pt;
font-weight: bold;
color: #FF0000;
}
-->
</style>
<body>
<%
request.setCharacterEncoding("utf-8");
// 获取表单所有字段信息
String a=request.getParameter("yonghuming");
String b=request.getParameter("xingbie");
String c=request.getParameter("biaoti");
String d=request.getParameter("liuyan");
//链接数据库
Connection myconn=null;
Class.forName("org.gjt.mm.mysql.Driver");
myconn=DriverManager.getConnection("jdbc:mysql://localhost/test1","root","520");
String sql="insert into messages(yonghuming,xingbie,biaoti,neiron) values(?,?,?,?) ";
PreparedStatement rsp=myconn.prepareStatement(sql);
rsp.setString(1,a);
rsp.setString(2,b);
rsp.setString(3,c);
rsp.setString(4,d);
rsp.executeUpdate();
myconn.close();
out.print("恭喜您已经成功留言!");
%>
</body>
<META HTTP-EQUIV=REFRESH CONTENT="4;URL=index.jsp">
本页面将在<span id=yu class="q">5</span><a href=javascript:countDown></a>秒后自动返回
<script>
function countDown(secs){
yu.innerText=secs;
if(--secs>0){
setTimeout("countDown("+secs+")",1000);
}
}
countDown(5);
</script>
</html>
5 网站开发总结
这是我们第一次完完整整的开发了一个网站,但是有很多功能有于技术实力难以实现,这次课程设计让我们学到了很多,第一,让我们更加深刻的了解了系统分析的重要性,提高了代码的运用能力和数据库的连接实现能力。第二,对jsp也有了进一步的了解,加深了对jsp以及MySQL数据库的印象。技术得到了锻炼。第三,让我们认识到了合作的重要性。
6 附录
参考文献
[1]梁建武,邹峰.JSP程序设计使用教程.中国水利水电出版社,2007.
[2]滕佳东,谢兰云,刘伟等. 管理信息系统.东北财经大学出版社,2009.
[3]李洪心. 电子商务概论.北京大学出版社,2007.
[4]网络文献
[5]百度文库 新浪资料 百度知道 搜搜