网络购物系统论文.doc_第1页
网络购物系统论文.doc_第2页
网络购物系统论文.doc_第3页
网络购物系统论文.doc_第4页
网络购物系统论文.doc_第5页
已阅读5页,还剩38页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

毕 业 论 文(设计) 题 目: 网络购物服务系统 系 名 称: 专业名称: 班级名称: 学生姓名: 学号: 指导教师: 完成时间: 目 录摘要 第1章 绪论1.1网上购物系统概述 .31.2 系统开发背景.4第二章 技术概述2.1什么事jsp,jsp的特点?.52.2 jsp的特点.52.3hibernate 技术2.3.1 hibernate优点.62.3.2 hibernate缺点.62.4 spring技术2.4.1spring技术的特点.72.4.2spring框架图:.72.4.3 spring web mvc的实现 .8第三章:需求分析.253.1 用户需求.253.2 需求分析和设计.263.2.1系统功能.263.3选择网上购物的原因.263.4用户选择商品配送的方式 .273.5网上交易存在的问题.27第四章:系统框架4.1系统架构图.284.2系统功能模块设计.28五系统网络数据库的建立5.1 数据源.375.1.1 创建数据库链接(hibernate).385.1.2 操作数据库.39结束语.41致谢.43参考文献】:.433网络购物系统的设计与实现专 业:软件技术 学 号:2009371049学生姓名: 指导老师:摘 要社会在不断的进步,科技在不断的发展,人民的生活水平在不断的提高,尤其是随着网技术和计算机技术的快速发展,以及数据库技术在网络中的应用,致使更多的电子商家和消费者之间建立畅通便捷的沟通和交易渠道,减少了企业的开支,减少了人们的不必要的时间浪费,为人们提供了周到和人性化的服务。为此我们选择了网上购物系统这个课题,以实现对网上交易等网上购物的一些探索和实践。开发后的网上系统包括六个模块即:普通客户模块、会员管理模块、管理员模块、系统管理模块、商品管理系统和在线购物模块。通过网上购物系统的建设以及实现对商业零售企业提供信息化管理。本文研究了一种基于数据关联规则网上购物系统,此方案与现今网上已采用的一些方案相比,具有用户使用更简单、界面更直观等优点。本系统基于html语言,嵌套了jsp编程技术。以jsh架构为环境,达到网上购物的目的。本篇着重论述了网上购物的可行性、网上购物的优势、系统功能与实现、数据流程及存储,包括商品目录,会员注册、网上订购与购物、库存查询、后台数据管理等。关键词:网上购物; jsp; 购物车; 数据库第一章 绪论1.1网上购物系统概述随着因特网的不断普及和信息高速公路的逐步延伸,人类社会现今已昂首步入信息社会时代,而商品交易模式在不断地发生着变化,从古老的以物换物到货币等价交换,到现在的看似虚拟的交换却有真更好的服务,服务的好坏严重的影响着交易好坏的进行。在社会化大生产以及社会分工日趋专业化的今天,网上购物无形的 占据着主要的地位。网上购物系统一般由商品管理、购物车管理、系统管理和会员管理等要素组成,是一个网上交易过程。其主要任务是交易各方以电子交易方式而不是通过当面交换或直接面谈方式进行的任何形式的商业交易。显然,这与“网上购物”的概念和内容既有联系,又有明显的区别。它们涉及的信息范围,服务功能以及社会意义等都不相同。网上购物系统搜集和管理的是特定的信息,其范围较窄,功能和目标比较明确、具体,主要是为特定的领域和机构的决策和管理服务;而信息管理则要对各类信息及其相关要素进行全方位管理,而对全社会开展信息服务,以便有效地满足社会的信息需求。今天,我们可以确信网上购物毋庸置疑是未来的发展方向。然而网上购物系统却还没有一个严格的定义。intel公司认为:网上购物=电子市场电子交易电子服务;ibm认为:网上购物=web;hp公司则说:“网上购物是通过电子化的手段来完成商业贸易活动的一种方式。”如此等等。那么究竟什么是网上购物系统呢?1.2 系统开发背景网上购物起源于七十年代。当时一些大公司通过建立自己的计算机网络实现各个机构之间、商业伙伴之间的信息共享,这个过程被称为edi(电子数据交换)。edi通过传递标准的数据流可以避免人为的失误、降低成本、提高效率,据估计在世界1000个最大的企业中,95%以上的在使用这一技术。它过去是、现在也是网上购物的基础。近年来,随着信息的全球化和国际互联网的普及化,越来越多的人想使用其无国界、无时间、无地域限制的便利环境来经营拓展商务。因此网上购物成为互联网应用的最大热点,越来越多的企业通过使用网上购物技术来进行商业上的交易以减少成本。当然,还有更多的公司想使用网络技术来架构一个虚拟的店面进行营业交易,企业与消费者通过网络完成交易,非但能使企业降低成本也可以让消费者在一个舒适的地点享受逛街与购物的乐趣。随着网上购物风潮的扩大,将会有更多的公司连上网络进行各项业务,而不只是将公司产品介绍的网页放在网站上供人浏览而已。现在,大多数企业已经建立自己的网站介绍和销售他们的产品。您只要拥有一个计算机、浏览器、internet连接和信用卡,今天就可以从网络上购买到书本、cd、鲜花、飞机票、电视甚至到汽车。如今网上购物已经成为企业增加市场竞争力的一种重要手段,同时人民购物更加方便快捷。第二章 技术概述21什么事jsp,jsp的特点? jsp技术使用java编程语言编写类xml的tags和scriptlets,来封装产生动态网页的处理逻辑。网页还能通过tags和scriptlets访问存在于服务端的资源的应用逻辑。jsp将网页逻辑与网页设计和显示分离,支持可重用的基于组件的设计,使基于web的应用程序的开发变得迅速和容易。web服务器在遇到访问jsp网页的请求时,首先执行其中的程序段,然后将执行结果连同jsp文件中的html代码一起返回给客户。插入的java程序段可以操作数据库、重新定向网页等,以实现建立动态网页所需要的功能。jsp与java servlet一样,是在服务器端执行的,通常返回给客户端的就是一个html文本,因此客户端只要有浏览器就能浏览。jsp的1.0规范的最后版本是1999年9月推出的,12月又推出了1.1规范。目前较新的是jsp1.2规范,jsp2.0规范的征求意见稿也已出台。jsp页面由html代码和嵌入其中的java代码所组成。服务器在页面被客户端请求以后对这些java代码进行处理,然后将生成的html页面返回给客户端的浏览器。java servlet 是jsp的技术基础,而且大型的web应用程序的开发需要java servlet和jsp配合才能完成。jsp具备了java技术的简单易用,完全的面向对象,具有平台无关性且安全可靠,主要面向因特网的所有特点。自jsp推出后,众多大公司都支持jsp技术的服务器,如ibm、oracle、bea公司等,所以jsp迅速成为商业应用的服务器端语言。jsp可用一种简单易懂的等式表示为:html+java=jsp。2.2 jsp的特点2.2.1一次编写,到处运行。除了系统之外,代码不用做任何更改。2.2.2系统的多平台支持。基本上可以在所有平台上的任意环境中开发,在任环境中进行系统部署,在任意环境中扩展。相比asp/.net的局限性是显而易2.2.3强大的可伸缩性。从只有一个小的jar文件就可以运行servlet/jsp,到由多台服务器进行集群和负载均衡,到多台application进行事务处理,消息处理,一台服务器到无数台服务器,java显示了一个巨大的生命力。2.2.4多样化和功能强大的开发工具支持。这一点与asp很像,java已经有了许多非常优秀的开发工具,而且许多可以免费得到,并且其中许多已经可以顺利的运行于多种平台之下。2.2.5支持服务器端组件。web应用需要强大的服务器端组件来支持,开发人员需要利用其他工具设计实现复杂功能的组件供web页面调用,以增强系统性能。jsp可以使用成熟的java beans 组件来实现复杂商务功能。2.3hibernate 技术2.3.1 hibernate优点对象/关系数据库映射(orm)它使用时只需要操纵对象,使开发更对象化,抛弃了数据库中心的思想,完全的面向对象思想透明持久化(persistent)带有持久化状态的、具有业务功能的单线程对象,此对象生存期很短。这些对象可能是普通的javabeans/pojo,这个对象没有实现第三方框架或者接口,唯一特殊的是他们正与(仅仅一个)session相关联。一旦这个session被关闭,这些对象就会脱离持久化状态,这样就可被应用程序的任何层自由使用。(例如,用作跟表示层打交道的数据传输对象。) 事务transaction(org.hibernate.transaction) 应用程序用来指定原子操作单元范围的对象,它是单线程的,生命周期很短。它通过抽象将应用从底层具体的jdbc、jta以及corba事务隔离开。某些情况下,一个session之内可能包含多个transaction对象。尽管是否使用该对象是可选的,但无论是使用底层的api还是使用transaction对象,事务边界的开启与关闭是必不可少的。 它没有侵入性,即所谓的轻量级框架 移植性会很好 缓存机制,提供一级缓存和二级缓存 简洁的hql编程 2.3.2 hibernate缺点 hibernate在批量数据处理时有弱势 针对单一对象简单的增删查改,适合于hibernate,而对于批量的修改,删除,不适合用hibernate,这也是or框架的弱点;要使用数据库的特定优化机制的时候,不适合用hibernate 2.4spring技术2.4.1spring技术的特点 轻量级(lightweight):轻量级有两层含义,其一,体积大小,其二,系统开销部署的时候仅需要一个比1m大一点儿的jar包,而在系统中其所用开销几乎可以忽略 .控制反转(inversion of control):spring使用ioc来解耦对象不再依赖于其它对象来创建自身,而是依赖于容器 .面向切面(aspect-oriented):spring 运用 面向切面编程(aop)来把业务逻辑分离的模块粘合到一起 容器(container):spring从某种意义上来说,它是一个管理生命周期 和 配置应用对象的容器 框架(framework):spring让把普通的组件通过配置和组合的方式,形成复杂应用程序成为一种可能2.4.2spring框架图:2.4.3 spring web mvc的实现 关于mvc,这是和web开发相关的部分,显然大家都是很熟悉了。从最初的jsp到struts,再到像wicket等等,真是百花齐放,百家争鸣.在web ui上,这部分是做web应用架构选择不可缺少的一部分。而作为mvc框架,也许spring mvc不能算得上是表现力最出色的ui框架,但无疑,它的实现也是非常的优秀,同时,我们可以从它的实现上,看到一个非常清晰的mvc实现的过程,从这点上看,真是非常的过瘾啊! 在了解ioc容器的基本实现的基础上,下面我们来看看,在典型的web环境中,spring ioc容器是如何在web环境中被载入并起作用的。我们可以看到,对于mvc这部分,主要建立在ioc的基础上,aop的特性应用得并不多。spring并不是天生就能在web容器中起作用的,同样也需要一个启动过程,把自己的ioc容器导入,并在web容器中建立起来。 与对ioc容器的初始化的分析一样,我们同样看到了loadbeandefinition对beandefinition的载入。在web环境中,对定位beandefinition的resource有特别的要求,对这个要求的处理体现在getdefaultconfiglocations方法的处理中。可以看到,在这里,使用了默认的beandefinition的配置路径,这个路径在xmlwebapplicationcontext中,已经作为一个常量定义好了,这个常量就是/web-inf/applicationcontext.xml。这里的loadbeandefinition实现如下所示:java代码1 public class xmlwebapplicationcontext extends abstractrefreshablewebapplicationcontext 2 /* default config location for the root context */3 /这里是设置缺省beandefinition的地方,在/web-inf/applicationcontext.xml文件里,如果不特殊指定其他文件,ioc容器会从这里读取beandefinition来初始化ioc容器4 public static final string default_config_location = /web-inf/applicationcontext.xml; 5 /* default prefix for building a config location for a namespace */6 public static final string default_config_location_prefix = /web-inf/; 7 /* default suffix for building a config location for a namespace */8 public static final string default_config_location_suffix = .xml; 9 /我们又看到了熟悉的loadbeandefinition,就像我们前面对ioc容器的分析一样,这个加载过程在容器refresh()时启动。10 protected void loadbeandefinitions(defaultlistablebeanfactory beanfactory) throws ioexception 11 / create a new xmlbeandefinitionreader for the given beanfactory.12 / 对于xmlwebapplicationcontext,当然是使用xmlbeandefinitionreader来对beandefinition信息进行解析13 xmlbeandefinitionreader beandefinitionreader = new xmlbeandefinitionreader(beanfactory); 14 / configure the bean definition reader with this contexts15 / resource loading environment.16 / 这里设置resourceloader,因为xmlwebapplicationcontext是defaultresource的子类,所以这里同样会使用defaultresourceloader来定位beandefinition 17 beandefinitionreader.setresourceloader(this); 18 beandefinitionreader.setentityresolver(new resourceentityresolver(this); 19 / allow a subclass to provide custom initialization of the reader,20 / then proceed with actually loading the bean definitions.21 initbeandefinitionreader(beandefinitionreader); 22 /这里使用定义好的xmlbeandefinitionreader来载入beandefinition23 loadbeandefinitions(beandefinitionreader); 24 25 protected void initbeandefinitionreader(xmlbeandefinitionreader beandefinitionreader) 26 27 /如果有多个beandefinition的文件定义,需要逐个载入,都是通过reader来完成的,这个初始化过程是由refreshbeanfactory方法来完成的,这里只是负责载入beandefinition28 protected void loadbeandefinitions(xmlbeandefinitionreader reader) throws beansexception, ioexception 29 string configlocations = getconfiglocations(); 30 if (configlocations != null) 31 for (string configlocation : configlocations) 32 reader.loadbeandefinitions(configlocation); 33 public class xmlwebapplicationcontext extends abstractrefreshablewebapplicationcontext /* default config location for the root context */ /这里是设置缺省beandefinition的地方,在/web-inf/applicationcontext.xml文件里,如果不特殊指定其他文件,ioc容器会从这里读取beandefinition来初始化ioc容器 public static final string default_config_location = /web-inf/applicationcontext.xml; /* default prefix for building a config location for a namespace */ public static final string default_config_location_prefix = /web-inf/; /* default suffix for building a config location for a namespace */ public static final string default_config_location_suffix = .xml; /我们又看到了熟悉的loadbeandefinition,就像我们前面对ioc容器的分析一样,这个加载过程在容器refresh()时启动。 protected void loadbeandefinitions(defaultlistablebeanfactory beanfactory) throws ioexception / create a new xmlbeandefinitionreader for the given beanfactory. / 对于xmlwebapplicationcontext,当然是使用xmlbeandefinitionreader来对beandefinition信息进行解析 xmlbeandefinitionreader beandefinitionreader = new xmlbeandefinitionreader(beanfactory); / configure the bean definition reader with this contexts / resource loading environment. / 这里设置resourceloader,因为xmlwebapplicationcontext是defaultresource的子类,所以这里同样会使用defaultresourceloader来定位beandefinition beandefinitionreader.setresourceloader(this); beandefinitionreader.setentityresolver(new resourceentityresolver(this); / allow a subclass to provide custom initialization of the reader, / then proceed with actually loading the bean definitions. initbeandefinitionreader(beandefinitionreader); /这里使用定义好的xmlbeandefinitionreader来载入beandefinition loadbeandefinitions(beandefinitionreader); protected void initbeandefinitionreader(xmlbeandefinitionreader beandefinitionreader) /如果有多个beandefinition的文件定义,需要逐个载入,都是通过reader来完成的,这个初始化过程是由refreshbeanfactory方法来完成的,这里只是负责载入beandefinition protected void loadbeandefinitions(xmlbeandefinitionreader reader) throws beansexception, ioexception string configlocations = getconfiglocations(); if (configlocations != null) for (string configlocation : configlocations) reader.loadbeandefinitions(configlocation); 进入dispatcherservlet和mvc实现 完成了在web环境中,ioc容器的建立以后,也就是在完成对contextloaderlistener的初始化以后,web容器开始初始化dispatcherservlet,接着,会执行dispatcherservlet持有的ioc容器的初始化过程,在这个初始化过程中,一个新的上下文被建立起来,这个dispatcherservlet持有的上下文,被设置为根上下文的子上下文。可以大致认为,根上下文是和web应用相对应的一个上下文,而dispatcherservlet持有的上下文是和servlet对应的一个上下文,在一个web应用中,往往可以容纳多个servlet存在;与此相对应,对于应用在web容器中的上下体系,也是很类似的,一个根上下文可以作为许多servlet上下文的双亲上下文。在dispatcherservlet,我们可以看到对mvc的初始化,是在dispatcherservlet的initstrategies完成的。 在这个初始化完成以后,会在上下文中建立器一个执行器于url的对应关系,这个对应关系可以让在url请求到来的时候,mvc可以检索到相应的控制器来进行处理,如以下代码所示:java代码 34 protected object gethandlerinternal(httpservletrequest request) throws exception 35 /这里从request中得到请求的url路径36 string lookuppath = this.urlpathhelper.getlookuppathforrequest(request); 37 /这里使用得到的url路径对handler进行匹配,得到对应的handler,如果没有对应的hanlder,返回null,这样默认的handler会被使用38 object handler = lookuphandler(lookuppath, request); 39 if (handler = null) 40 / we need to care for the default handler directly, since we need to41 / expose the path_within_handler_mapping_attribute for it as well.42 object rawhandler = null; 43 if (/.equals(lookuppath) 44 rawhandler = getroothandler(); 45 46 if (rawhandler = null) 47 rawhandler = getdefaulthandler(); 48 49 if (rawhandler != null) 50 validatehandler(rawhandler, request); 51 handler = buildpathexposinghandler(rawhandler, lookuppath, null); 52 53 54 if (handler != null & logger.isdebugenabled() 55 logger.debug(mapping + lookuppath + to handler + handler + ); 56 57 else if (handler = null & logger.istraceenabled() 58 logger.trace(no handler mapping found for + lookuppath + ); 59 60 return handler; 61 62 / lookuphandler是根据url路径,启动在handlermap中对handler的检索,并最终返回handler对象63 protected object lookuphandler(string urlpath, httpservletrequest request) throws exception 64 / direct match?65 object handler = this.handlermap.get(urlpath); 66 if (handler != null) 67 validatehandler(handler, request); 68 return buildpathexposinghandler(handler, urlpath, null); 69 70 / pattern match?71 string bestpathmatch = null; 72 for (string registeredpath : this.handlermap.keyset() 73 if (getpathmatcher().match(registeredpath, urlpath) & 74 (bestpathmatch = null | bestpathmatch.length() registeredpath.length() 75 bestpathmatch = registeredpath; 76 77 78 if (bestpathmatch != null) 79 handler = this.handlermap.get(bestpathmatch); 80 validatehandler(handler, request); 81 string pathwithinmapping = getpathmatcher().extractpathwithinpattern(bestpathmatch, urlpath); 82 map uritemplatevariables = 83 getpathmatcher().extracturitemplatevariables(bestpathmatch, urlpath); 84 return buildpathexposinghandler(handler, pathwithinmapping, uritemplatevariables); 85 86 / no handler found.87 return null; 88 protected object gethandlerinternal(httpservletrequest request) throws exception /这里从request中得到请求的url路径 string lookuppath = this.urlpathhelper.getlookuppathforrequest(request); /这里使用得到的url路径对handler进行匹配,得到对应的handler,如果没有对应的hanlder,返回null,这样默认的handler会被使用 object handler = lookuphandler(lookuppath, request); if (handler = null) / we need to care for the default handler directly, since we need to / expose the path_within_handler_mapping_attribute for it as well. object rawhandler = null; if (/.equals(lookuppath) rawhandler = getroothandler(); if (rawhandler = null) rawhandler = getdefaulthandler(); if (rawhandler != null) validatehandler(rawhandler, request); handler = buildpathexposinghandler(rawhandler, lookuppath, null); if (handler != null & logger.isdebugenabled() logger.debug(mapping + lookuppath + to handler + handler + ); else if (handler = null & logger.istraceenabled() logger.trace(no handler mapping found for + lookuppath + ); return handler; / lookuphandler是根据url路径,启动在handlermap中对handler的检索,并最终返回handler对象 protected object lookuphandler(string urlpath, httpservletrequest request) throws exception / direct match? object handler = this.handlermap.get(urlpath); if (handler != null) validatehandler(handler, request); return buildpathexposinghandler(handler, urlpath, null); / pattern match? string bestpathmatch = null; for (string registeredpath : this.handlermap.keyset() if (getpathmatcher().match(registeredpath, urlpath) & (bestpathmatch = null | bestpathmatch.length() registeredpath.length() bestpathmatch = registeredpath; if (bestpathmatch != null) handler = this.handlermap.get(bestpathmatch); validatehandler(handler, request); string pathwithinmapping = getpathmatcher().extractpathwithinpattern(bestpathmatch, urlpath); map uritemplatevariables = getpathmatcher().extracturitemplatevariables(bestpathmatch, urlpath); return buildpathexposinghandler(handler, pathwithinmapping, uritemplatevariables);

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论