基于JSP的在线书店销售系统的设计与实现外文文献及翻译
- 格式:doc
- 大小:260.55 KB
- 文档页数:14
毕业设计说明书基于JSP的在线书店销售系统的设计与实现专业学生姓名班级学号指导教师完成日期基于JSP的在线书店销售系统的设计与实现摘要:21世纪,随着计算机科学技术的发展,贸易的全球化和网络的全球化两大特征走到了一起,形成了如今风靡全球的电子商务。
电子商务在Internet中的应用越来越广泛,为广大网络用户提供了更加周到和人性化的服务已逐渐成为当今Web应用的潮流,而购物网站正是这种活动的具体表现形式。
网上购物在我国的发展虽不如欧美,但当今发展很快,众多网上购物网站不断涌现,较有代表的如eBay易趣、taobao淘宝、1pai雅虎新浪一拍等。
随着我国互联网的更加普及和电子商务的日趋成熟,会有越来越大的消费群体,市场潜力会得到充分发挥。
与传统C/S相比,B/S更具优势(如客户端无须安装软件等)。
合理规划和设计B/S模式的电子商务网站,直接关系到网络销售系统的运行效率,以及消费者的兴趣。
对网络销售系统不合时宜的设计,不仅无助于问题的解决,而且会耽误商机,使自己处于被动地位。
临渊羡鱼,不如退而结网。
网络购物系统的完善和便捷将是现代社会必然的需求。
任务书研究了基于JSP技术和SQL Server数据库开发网络图书销售系统的全过程。
关键词:电子商务;网络图书销售系统;JSPDesign and implementation of online bookstore salessystem based on JSPAbstract:In the 21st century, with the development of science and technology of the computer, trade globalization and two major characteristics of globalization of the network got togather, have formed the nowadays-fashionable e-commerce in the world. The application in Internet of e-commerce is more and more extensive, have already nowadays become the trend that Web uses gradually users more thoughtful and more humanized service after offering to the masses of network, and the shopping website is exactly this kind of concrete form of expression of moving about. Although the development of online shopping in our country is not so good as America and Europe, nowadays develop quickly, emerge constantly, have relatively on behalf of if eBay E, taobao, 1pai,etc. With Internet popularization and e-commerce of our country ripe becoming, there are bigger and bigger consumption colonies; the market potential will be given full play to. Compared with traditional C/S, B/S has even more advantages (such as needn't install software in the client, etc.). Rational planning and designing the e-commerce website of B/S mode, concern the operational efficiency of the marketing system of the network, and consumers' interest directly. The unseasonable design to the marketing system of the network is not only helpless to the settlement of the problem, but alse delay the business opportunity, will make oneself in the passive position. It's better to go back and make a net than to stand by the pond and long for fish. The systematic perfection and convenient of shopping at network will be modern society's inevitable demands. This text has studied the whole course of books marketing system of network on the basis of JSP technology and SQL Server database. Key words:E-commerce; books marketing system of network; ASP目录1概述 (1)1.1课题背景 (1)1.2课题研究的意义和现状 (1)1.3课题的系统概述 (2)2在线书店销售系统的相关技术介绍 (3)2.1B ROWSER/SERVER结构 (3)2.1.1三层结构 (4)2.2JSP的运作模式 (4)2.3SQL S ERVER 2005简介 (5)3 基于JSP的在线书店销售系统的设计 (5)3.1需求分析 (5)3.1.1系统需要解决的主要问题 (5)3.1.2系统开发环境 (6)3.2系统具备的功能 (6)3.3用例模型 (6)3.3.1用户U SE CASE图 (6)3.3.2管理员U SE CASE图 (7)3.3.3书店销售系统E-R图 (7)3.4数据库的设计与实现 (8)3.4.1数据库的需求分析 (8)3.4.2数据库的逻辑设计 (8)3.5数据库的结构创建 (9)4基于JSP的在线书店销售系统的实现 (12)4.1后台系统和数据库的配置 (12)4.1.1后台服务器配置 (12)4.1.2后台数据库的配置 (12)4.1.3后台全局配置文件 (12)4.2前端网络页面的开发与设计 (13)4.2.1用户注册网页 (13)4.2.2用户登录页面 (17)4.2.3管理员操作页面 (18)4.2.4用户购物操作 (20)4.2.5管理员管理页面 (23)4.2.6个人资料修改页面 (24)5系统测试 (26)5.1软件测试的目的和原则 (26)5.2测试的方法 (26)5.2.1黑盒测试 (26)5.2.2白盒测试 (26)5.3测试实例(测试集)的研究与选择 (27)5.4系统的维护 (27)6结束语 (28)参考文献 (29)致谢 (31)基于JSP的在线书店销售系统的设计与实现1概述1.1课题背景新世纪的到来,Internet和计算机网络技术的蓬勃发展,网络化和全球化已成为不可抗拒的世界潮流。
基于JSP的网上图书销售系统的设计与实现本科(毕业论文终稿)原创性声明本人郑重声明:本人所呈交的毕业论文,是在指导老师的指导下独立进行研究所取得的成果。
毕业论文中凡引用他人已经发表或未发表的成果、数据、观点等,均已明确注明出处。
除文中已经注明引用的内容外,不包含任何其他个人或集体已经发表或撰写过的科研成果。
对本文的研究成果做出重要贡献的个人和集体,均已在文中以明确方式标明。
本声明的法律责任由本人承担。
论文作者签名:日期:关于毕业论文使用授权的声明本人在指导老师指导下所完成的论文及相关的资料(包括图纸、试验记录、原始数据、实物照片、图片、录音带、设计手稿等),知识产权归属平顶山学院。
本人完全了解平顶山学院有关保存、使用毕业论文的规定,同意学校保存或向国家有关部门或机构送交论文的纸质版和电子版,允许论文被查阅和借阅;本人授权平顶山学院可以将本毕业论文的全部或部分内容编入有关数据库进行检索,可以采用任何复制手段保存和汇编本毕业论文。
如果发表相关成果,一定征得指导教师同意,且第一署名单位为平顶山学院。
本人离校后使用毕业论文或与该论文直接相关的学术论文或成果时,第一署名单位仍然为平顶山学院。
论文作者签名:日期:指导老师签名:日期:网上图书销售系统的设计与实现摘要计算机和网络技术的飞速发展,对传统的商品交易形式和流通方式产生了极大的影响。
人们通过互联网进行网上交易,足不出户的获得想要的各种商品。
随着人们对信息的获取方式和获取途径的改变,对传统的图书销售带来挑战,图书很适合网上销售,因此网上图书销售系统的开发具有重要意义,建立相应的网上图书销售系统显得尤其必要。
该论文首先研究了与本设计相关的MVC设计模式、JDBC、JSP和Servlet技术,学习了MySQL和MyEclipse8.0开发工具的使用;分析了系统功能需求、性能需求和安全需求;建立了系统的总体设计方案,并在此基础上对系统的主要功能模块、数据库和接口进行了详细的设计,最后实现了系统所具有的前台和后台管理两大基本功能模块。
毕业设计说明书英文文献及中文翻译学生姓名:学号:学院:专业:指导教师:Struts——an open-source MVC implementationBy: Malcolm Davis.Source: Struts--an open-source MVC implementation[J].IBM Systems JournalThis article introduces Struts, a Model-View-Controller implementation that uses servlets and JavaServer Pages (JSP) technology. Struts can help you control change in your Web project and promote specialization. Even if you never implement a system with Struts,you may get some ideas for your future servlets and JSP page implementation.IntroductionKids in grade school put HTML pages on the Internet. However, there is a monumental difference between a grade school page and a professionally developed Web site. The page designer (or HTML developer) must understand colors, the customer, product flow, page layout, browser compatibility, image creation, JavaScript, and more. Putting a great looking site together takes a lot of work, and most Java developers are more interested in creating agreat looking object interface than a user interface. Java Server Pages (JSP) technology provides the glue between the page designer and the Java developer.If you have worked on a large-scale Web application, you understand the term change.Model-View-Controller (MVC) is a design pattern put together to help control change. MVC decouples interface from business logic and data. Struts is an MVC implementation that uses Servlets 2.2 and JSP 1.1 tags, from the J2EE specifications, as part of the implementation. Y ou may never implement a system with Struts, but looking at Struts may give you some ideas on your future Servlets and JSP implementations.Model-View-Controller (MVC)JSP tags solved only part of our problem. We still have issues with validation, flow control, and updating the state of the application. This is where MVC comes to the rescue.MVC helps resolve some of the issues with the single module approach by dividing theproblem into three categories:• ModelThe model contains the core of the application's functionality. The model encapsulates thestate of the application. Sometimes the only functionality it contains is state. It knows nothing about the view or controller.• View• The view provides the presentation of the model. It is the look of the application. The view can access the model getters, but it has no knowledge of the setters. In addition, it knows nothing about the controller. The view should be notified when changes to the model occur. ControllerThe controller reacts to the user input. It creates and sets the model.MVC Model 2The Web brought some unique challenges to software developers, most notably the stateless connection between the client and the server. This stateless behavior made it difficult for the model to notify the view of changes. On the Web, the browser has to re-query the server to discover modification to the state of the application.Another noticeable change is that the view uses different technology for implementation than the model or controller. Of course, we could use Java (or PERL, C/C++ or what ever) code to generate HTML. There are several disadvantages to that approach:• Java programmers should develop services, not HTML.• Changes to layout would require changes to code.• Customers of the service should be able to create pages to meet their specific needs.• The page designer isn't able to have direct involvement in page development.• HTML embedded into code is ugly.For the Web, the classical form of MVC needed to change.MVC Model 2 Struts, an MVC 2 implementation Struts is a set of cooperating classes, servlets, and JSP tags that make up a reusable MVC 2 design. This definition implies that Struts is a framework, rather than a library, but Struts also contains an extensive tag library and utility classes that work independently of the framework.• Client browserAn HTTP request from the client browser creates an event. The Web container will respond with an HTTP response.• ControllerThe Controller receives the request from the browser, and makes the decision where to send the request. With Struts, the Controller is a command design pattern implemented as a servlet. The struts-config.xml file configures the Controller.• Business logicThe business logic updates the state of the model and helps control the flow of the application.With Struts this is done with an Action class as a thin wrapper to the actual business logic.• Model stateThe model represents the state of the application. The business objects update the application state. ActionForm bean represents the Model state at a session or request level, and not at a persistent level. The JSP file reads information from the ActionForm bean using JSP tags.• ViewThe view is simply a JSP file. There is no flow logic, no business logic, and no model information -- just tags. Tags are one of the things that make Struts unique compared to other frameworks like V elocity.Struts detailsDisplayed in Figure 6 is a stripped-down UML diagram of the org.apache.struts.action package and shows the minimal relationships among ActionServlet (Controller), ActionForm (Form State), and Action (Model Wrapper).The ActionServlet classDo you remember the days of function mappings? Y ou would map some input event to a ointer to a function. If you where slick, you would place the configuration information into ale and load the file at run time. Function pointer arrays were the good old days of structured rogramming in C.Life is better now that we have Java technology, XML, J2EE, and all that. The Struts ontroller is a servlet that maps events (an event generally being an HTTP post) to classes. guess what -- the Controller uses a configuration file so you don_t have to hard-code the alues. Life changes, but stays the same.ActionServlet is the Command part of the MVC implementation and is the core of the ramework. ActionServlet (Command) creates and uses Action, an ActionForm, and ctionForward. As mentioned earlier, the struts-config.xml file configures the command. uring the creation of the Web project, Action and ActionForm are extended to solve the pecific problem space. The file struts-config.xml instructs ActionServlet on how to use the xtended classes. There are several advantages to this approach:• The entire logical flow of the application is in a hierarchical text file. This makes itasier to view and understand, especially with large applications.• The page designer does not have to wade through Java code to understand the flow of e application.• The Java developer does not need to recompile code when making flow changes. Command functionality can be added by extending ActionServlet.The ActionForm classActionForm maintains the session state for the Web application. ActionForm is anbstract class that is sub-classed for each input form model. When I say input form model, Im saying ActionForm represents a general concept of data that is set or updated by a HTML form. For instance, you may have a UserActionForm that is set by an HTML Form. The Struts framework will:• Check to see if a UserActionForm exists; if not, it will create an instance of the class.• Struts will set the state of the UserActionForm using corresponding fields from the HttpServletRequest. No more dreadful request.getParameter() calls. For instance, the Struts framework will take fname from request stream and call UserActionForm.setFname().• The Struts framework updates the state of the UserActionForm before passing it to the business wrapper UserAction.• Before passing it to the Action class, Struts will also conduct form state validation by calling the validation() method on UserActionForm. Note: This is not always wise to do. There might be ways of using UserActionForm in other pages or business objects, where the validation might be different. V alidation of the state might be better in the UserAction class.• The UserActionForm can be maintained at a session level.Notes:• The struts-config.xml file controls which HTML form request maps to which ActionForm. • Multiple requests can be mapped UserActionForm.• UserActionForm can be mapped over multiple pages for things such as wizards.The Action classThe Action class is a wrapper around the business logic. The purpose of Action class is to translate the HttpServletRequest to the business logic. To use Action, subclass and overwrite the process() method.The ActionServlet (Command) passes the parameterized classes to ActionForm using the perform() method. Again, no more dreadful request.getParameter() calls. By the time the event gets here, the input form data (or HTML form data) has already been translated out of the request stream and into an ActionForm class.Note: "Think thin" when extending the Action class. The Action class should control the flow and not the logic of the application. By placing the business logic in a separate package or EJB, we allow flexibility and reuse.Another way of thinking about Action class is as the Adapter design pattern. The purpose of the Action is to "Convert the interface of a class into another interface the clients expect. Adapter lets classes work together that couldn_t otherwise because of incompatibility interface" (from Design Patterns - Elements of Reusable OO Software by Gof). The client in this instance is the ActionServlet that knows nothing about our specific business class interface. Therefore, Struts provides a business interface it does understand, Action. By extending the Action, we make our business interface compatible with Struts business interface. (An interesting observation is that Action is a class and not an interface. Action started as an interface and changed into a class over time. Nothing's perfect.)The Error classesThe UML diagram (Figure 6) also included ActionError and ActionErrors. ActionError encapsulates an individual error message. ActionErrors is a container of ActionError classes that the View can access using tags. ActionErrors is Struts way of keeping up with a list of errors.UML diagram of the relationship of the Command (ActionServlet) to the Model (Action) The ActionMapping classAn incoming event is normally in the form of an HTTP request, which the servlet Container turns into an HttpServletRequest. The Controller looks at the incoming event and dispatches the request to an Action class. The struts-config.xml determines what Action class the Controller calls. The struts-config.xml configuration information is translated into a set of ActionMapping, which are put into container of ActionMappings. (If you have not noticed it, classes that end with s are containers) The ActionMapping contains the knowledge of how a specific event maps to specific Actions. The ActionServlet (Command) passes the ActionMapping to the Action class via the perform() method. This allows Action to access the information to control flow.ActionMappingsActionMappings is a collection of ActionMapping objects.Struts pros Use of JSP tag mechanism The tag feature promotes reusable code and abstracts Java code from the JSP file. This feature allows nice integration into JSP-based development tools that allow authoring with tags.• Tag libraryWhy re-invent the wheel, or a tag library? If you cannot find something you need in the library, contribute. In addition, Struts provides a starting point if you are learning JSP tag technology.• Open sourceY ou have all the advantages of open source, such as being able to see the code and having everyone else using the library reviewing the code. Many eyes make for great code review.• Sample MVC implementationStruts offers some insight if you want to create your own MVC implementation.• Manage the problem spaceDivide and conquer is a nice way of solving the problem and making the problem manageable.中北大学2014届毕业设计英文文献译文Struts 一个开源的MVC实现作者:马尔科姆·戴维斯。
文献综述计算机科学与技术基于JSP的网上书店系统的设计与实现一前言随着中国加入WTO,全球经济一体化的逐步深入,网上书店已是现代传统书店必不可少的经营策略之一了。
所以为了更方便、省时得买到自己所需的书籍,我们选择开发网上书店。
另一个原因,由于网上书店批发经销经营,与各出版社及图书发行商合作密切,且批发业务遍及全国各地,因此也能在价格、图书经营范围上以及物流供应链上比其它传统书店都有较大的优势。
传统的购物方式寻找商品所花费的时间、付出的交通费用以及体力上的透支相对于越来越烦忙的人们来说是一种浪费,随着Internet的普及以及人们生活质量的提高,消费者渐渐意识到网上购物方便快捷的优越性,成为一支新兴的重要的不断壮大的消费队伍,因此,构建网上书店,是适应消费者消费方式转变的需要。
赢得消费者才能赢得市场。
二JSP概述SP(全称J ava S erver P ages)是由Sun Microsystems公司倡导和许多公司参与共同创建的一种使软件开发者可以响应客户端请求,而动态生成HTML、XML或其他格式文档的Web网页的技术标准[1]。
JSP技术是以java语言作为脚本语言的,JSP网页为整个服务器端的Java库单元提供了一个接口来服务于Http的应用程序。
JSP使Java代码和特定的预定义动作可以嵌入到静态页面中。
JSP句法增加了被称为JSP动作的XML标签,它们用来调用内建功能。
另外,可以创建JSP标签库,然后像使用标准HTML或XML标签一样使用它们[2]。
标签库提供了一种和平台无关的扩展服务器性能的方法。
JSP被JSP编译器编译成Java Servlets。
一个JSP编译器可以把JSP编译成JAVA代码写的servlet然后再由JAVA编译器来编译成机器码,也可以直接编译成二进制码。
三JSP的运行原理在JSP第一次获得来自于客户端浏览器的请求时,JSP文件将被JSP引擎(JSP engine)转换成一个Servlet,即将”.jsp”文件编译成Java Class文件。
河北工业大学城市学院毕业设计说明书作者:李永康学号:065514系:计算机科学与软件学院专业:计算机科学与技术专业题目:基于JSP的在线书店系统指导者:李建伟副教授评阅者:2010年 6月 3日目次1 引言 (1)2 可行性分析 (3)3 需求分析 (4)4 系统设计思想 (6)5 网站架设 (6)5.1 开发环境 (6)5.2 建立站点 (6)6 数据库的设计 (7)6.1 数据库的分析 (7)6.2 数据表的结构 (7)7 JavaBean技术在系统中的应用 (10)8 前台开发 (16)8.1 设计分析 (16)8.2 重点推荐图书的实现过程 (17)8.3 新到图书实现过程 (19)8.4 图书分类实现过程 (19)8.5 用户管理实现过程 (20)8.6 购物车实现过程 (21)8.7 生成订单实现过程 (23)8.8 订单查询实现过程 (24)9 后台开发 (25)9.1 设计分析 (25)9.2 后台登录实现过程 (25)9.3 图书管理实现过程 (26)9.4 用户管理实现过程 (28)9.5 订单管理实现过程 (29)9.6 退出系统实现过程 (30)结论 (31)参考文献 (32)致谢 (33)1 引言当今世界,电子商务已经成为一大热点。
无论是传统的制造业或是新兴的金融企业,都把电子商务作为企业经营的一种新方式,纷纷投入巨资建立网站,在国际互联网上从事BtoB,BtoC的各类商业活动,在网上进行交易。
互联网从它出现开始就不仅改变了信息传递的方式,同时改变着企业的运营模式,管理模式,影响着人们的生活观念,改变着人们的习惯。
网络使人们足不出户就能获取各方面的信息,而电子商城的出现更是人们足不出户就可以进行商品交易活动。
互电子商务网站有什么特性?将如何发展?不少人以为Internet时代的电子商务是新经济,是独立于旧经济体制之外的,不受经济规律制约的"新人类",这是一个美丽的错误。
基于JSP的在线书店销售系统的设计与实现 - 外文文献及翻译文献来源本文献选自2019年IEEE会议论文集,作者为Qiuyue Luo、Liangye He。
原文题目为Design and Implementation of Online Bookstore Sales System based on JSP。
文献摘要随着网络技术的快速发展,越来越多的商业活动正在向线上迁移。
在线书店作为一个重要的商业模式之一,成为了一个备受关注的领域。
本文献介绍了一种基于JSP技术的在线书店销售系统的设计与实现。
该系统包括用户注册、书籍浏览、购物车、订单管理等功能模块。
通过对系统的详细设计,提高了系统的可靠性、安全性、稳定性和性能,从而为用户提供更好的在线购物体验。
文献翻译随着互联网技术的飞速发展,越来越多的商业活动正在向线上迁移。
在线书店成为了一个备受关注的领域。
为了更好地满足用户的需求,设计和实现一个高效可靠的在线书店销售系统显得尤为重要。
本文献介绍了一种基于JSP技术的在线书店销售系统的设计和实现。
该系统包括用户注册、书籍浏览、购物车、订单管理等功能模块。
通过本系统的详细设计,提高了系统的可靠性、安全性、稳定性和性能,为用户提供更好的在线购物体验。
具体来说,本系统的设计和实现主要包括以下方面:1.用户注册和登录功能:用户可以使用自己的账号和密码登录系统,也可以选择注册新的账号。
2.书籍浏览和搜索功能:用户可以浏览所有书籍的详细信息,并根据自己的需求进行搜索。
3.购物车功能:用户可以将自己喜欢的书籍添加到购物车中,并随时查看购物车中的商品数量和价格。
4.订单管理功能:用户可以查看自己的订单,并对订单进行管理和修改。
本系统采用了JSP技术和MySQL数据库,可以实现高效、可靠和安全的在线交易。
值得注意的是,为了提高系统的安全性和可靠性,我们采用了多个措施。
首先,用户的账号和密码将被加密保存,避免被不法之徒获取。
【完整版】基于JSP模拟当当⽹图书销售系统毕业论⽂设计第⼀章绪论1.1课题背景随着Internet 的迅速崛起,⽹络信息化的发展,在线图书销售作为⼀种典型的Web 电⼦商务系统也迅速的发展并深⼊⼈们的⽇常⽣活中。
更多的⼈更愿意⾜不出户就可以挑选购买⾃⼰喜欢的各种书籍,这样⼤⼤缩短了购书的时间,提⾼了效率。
⽽且,图书因其具有标识精晰、规格统⼀、特征容易描述、同种商品个体之间⽆差异等特性⽽能成为发展电⼦商务的最为理想的商品类型。
可见,⽹上图书销售系统跨越了时间和空间的限制,给商业流通领域带来了不⼀样的变⾰,也给消费者带来了便捷。
只要⽹络发展没有停⽌,⽹上图书销售的发展就不会停⽌。
1.2本课题研究内容本系统采⽤BS(BrowserServer)结构进⾏设计,使⽤MYSQL 构建数据库,并在JSP 环境下使⽤JA V A 语⾔开发的⼀个功能完善的⽹上图书销售系统。
其具有⼀定的实⽤性,⽤户可以在⽹上浏览图书信息,查找图书资料,将⾃⼰喜欢的放⼊购物车并下订单购买;同时,管理员也可以对整个系统的信息和数据进⾏管理,可以管理库存书信息、分类信息、出版社信息、⽤户信息和订单信息。
1.3本课题研究的意义本课题的⽬标就是是将图书销售由传统的商店模式向在线销售的转变,同时还对销售的定单和图书的种类等信息进⾏在线管理,其意义就在于以此来实现⼈们不出门就能够便捷的买到⾃⼰喜欢的各种书籍,向客户展⽰出⼀种新颖的购书理念。
⽹上购书的⽅式必将⽇趋被⼤家所接受。
第⼆章软件体系结构及关键技术2.1软件体系结构2.1.1BS结构介绍BS结构(BrowserServer,浏览器服务器模式),是WEB兴起后的⼀种⽹络结构模式,实质上是以Java技术为核⼼、以J2EE 为平台的计算模式。
Web 浏览器是客户端最主要的应⽤软件,这种模式统⼀了客户端,将系统功能实现的核⼼部分集中到服务器上,使系统的开发可以⼀次性到位,并能实现不同的使⽤者,从不同的地点,以不同的⽹络接⼊⽅式(⽐如LAN,WAN,InternetIntranet等)来访问和操作共同的数据库;并且通过设置合理的⽤户权限,来有效地保护数据库平台和管理访问权限,服务器数据库也很安全,特别是在Java这样的跨平台语⾔出现之后,BS架构管理软件更加⽅便、快捷、⾼效。
大连理工大学硕士学位论文基于JSP技术的网上书店系统设计与实现姓名:于阁申请学位级别:硕士专业:计算机技术指导教师:杨元生20061201大连理工大学专业学位硕士学位论文站点主要文件夹的名称及存放路径如表4.10所示。
表4.10站点各文件夹说明Tab.4.10Tableforwebsitefolders4.3.2用户界面设计(1)重点推荐展台的实现过程在网站首页的主体部分,分栏列出了网站推荐的图书信息,主要包括图书的封面、名称、出版社、作者及定价等信息,同时设置了“添加至购物车”和查看“按钮”,分别用于将图书添加至购物车和查看详细信息。
如图4.6所示。
4.6主界面Fig.4.6Maininterface基于JSP技术的网上书店系统设计与实现重点推荐图书信息同图书基本信息同时保存在图书信息表中,以字段commend标识,值为1时代表是重点推荐,0为一般。
在显示时采用了分栏技术,在这里是指用for语句循环显示结果中的记录,并应用if"一else语句根据循环增量与2(分栏数)求模后的值显示相应的内容。
“添加购物车”按钮是只有登录后的用户才可以看到;用户单击查看按钮后,可以查看图书的详细信息,实现此功能的方法是:在查看按钮的onClick事件中,将页面连接到book_detail.jsp页面并传递相应的ISBN号,然后在显示信息页面中通过ISBN号进行检索即可。
(2)新书上架实现过程在首页中,单击“新书上架”超链接可以进入到新书上架页面newbook.jsp,在该页面中显示了全部的上架新书的重点信息,用户可以单击书名超链接查看图书的详细信息。
页面如图4.7・所示。
,上架新书信息保存在图书信息表tbbookinfo中,以字段newbook标识,当newbook为1时,代表该书是新书。
图4.7新书上架Fig.4.7Informationofnewbooks大连理工大学专业学位硕士学付论文(3)图书分类实现过程为了方便用户查询所需图书信息,在网站中设置了图书分类显示功能。
毕业设计(论文) 外文文献翻译专业学生姓名班级学号指导教师外文资料名称:An Overview of Servletand JSP Technology 外文资料出处:Internet附件: 1.外文资料翻译译文2.外文原文Servlet和JSP技术简述Nagle and WiegleyXX译摘要:Servlet程序在服务器端运行,动态地生成Web页面与传统的CGI和许多其他类似CGI的技术相比,Java Servlet具有更高的效率,更容易使用,功能更强大,具有更好的可移植性,更节省投资。
关键字:JSP技术,Servlet,HTTP服务1.1Servlet的功能Servlets是运行在Web或应用服务器上的Java程序,它是一个中间层,负责连接来自Web浏览器或其他HTTP客户程序的请求和HTTP服务器上的数据库或应用程序。
Servlet的工作是执行西门的任务,如图1.1所示。
图1.1Web中间件的作用(1)读取客户发送的显式数据。
最终用户一般在页面的HTML表单中输入这些数据。
然而,数据还有可能来自applet或定制的HTTP客户程序。
(2)读取由浏览器发送的隐式请求数据。
图1.1中显示了一条从客户端到Web服务器的单箭头,但实际上从客户端传送到Web服务器的数据有两种,它们分别为用户在表单中输入的显式数据,以及后台的HTTP信息。
两种数据都很重要。
HTTP信息包括cookie、浏览器所能识别的媒体类型和压缩模式等。
(3)生成结果。
这个过程可能需要访问数据库、执行RMI或EJB调用、调用Web服务,或者直接计算得出对应的响应。
实际的数据可能存储在关系型数据库中。
该数据库可能不理解HTTP,或者不能返回HTML形式的结果,所有Web浏览器不能直接与数据库进行会话。
即使它能够做到这一点,为了安全上的考虑,我们也不希望让它这么做。
对应大多数其他应用程序,也存在类似的问题。
因此,我们需要Web中间层从HTTP流中提取输入数据,与应用程序会话,并将结果嵌入到文档中。
(4)向客户发送显式数据(即文档)。
这个文档可以用各种格式发送,包括文本(HTML或XML),二进制(GIF图),甚至可以式建立在其他底层格式之上的压缩格式,如gzip。
但是,到目前为止,HTML 式最常用的格式,故而servelt和JSP的重要任务之一就式将结果包装到HTML中。
(5)发送隐式的HTTP响应数据。
图1.1中显示了一条从Web中间层到客户端的单箭头。
但是,实际发送的数据有两种:文档本身,以及后台的HTTP信息。
同样,两种数据对开发来说都式至关重要的。
HTTP响应数据的发送过程涉及告知浏览器或其他客户程序所返回文档的类型(如HTML),设置cookie和缓存参数,以及其他类似的任务。
1.2动态构建网页的原因预先建立的文档可以满足客户的许多请求,服务器无需调用servlet就可以处理这些请求。
然而,许多情况下静态的结果不能满足要求,我们需要针对每个请求生成一个页面。
实时构建页面的理由有很多种:1、网页基于客户发送的数据。
例如,搜索引擎生成的页面,以及在线商店的订单确认页面,都要针对特定的用户请求而产生。
在没有读取到用户提交的数据之前,我们不知道应该显示什么。
要记住,用户提交两种类型的数据:显示(即HTML表单的数据)和隐式(即HTTP请求的报头)。
两种输入都可用来构建输出页面。
基于cookie值针对具体用户构建页面的情况尤其普遍。
2、页面由频繁改变的数据导出。
如果页面需要根据每个具体的请求做出相应的改变,当然需要在请求发生时构建响应。
但是,如果页面周期性地改变,我们可以用两种方式来处理它:周期性地在服务器上构建新的页面(和客户请求无关),或者仅仅在用户请求该页面时再构建。
具体应该采用哪种方式要根据具体情况而定,但后一种方式常常更为方便,因为它只需简单地等待用户的请求。
例如,天气预报或新闻网站可能会动态地构建页面,也有可能会返回之前构建的页面(如果它还是最新的话)。
3、页面中使用了来自公司数据库或其他数据库断数据源的信息。
如果数据存储在数据库中,那么,即使客户端使用动态Web内容,比如applet,我们依旧需要执行服务器端处理。
想象以下,如果一个搜索引擎网站完全使用applet,那么用户将会看到:“正在下载50TB的applet,请等待!”。
显然,这样很愚蠢;这种情况下,我们需要与数据库进行会话。
从客户端到Web层再到数据库(三层结构),要比从applet直接到数据库(二层结构)更灵活,也更安全,而性能上的损失很少甚至没有。
毕竟数据库调用通常是对速度影响最大的步骤,因而,经过中间层可以执行高速缓存和连接共享。
理论上讲,servelt并非只用于处理HTTP请求的Web服务器或应用服务器,它同样可以用于其他类型的服务器。
例如,servlet能够嵌入到FTP或邮件服务器中,扩展他们的功能。
而且,用于会话启动协议服务器的servlet API最近已经被标准化(参见/en/jsr/detail?id=116)。
但在实践中,servelt的这种用法尚不流行,在此,我们只论述HTTP Servlet。
1.3 Servlet相对于“传统”CGI的优点和传统CGI及许多类CGI技术相比,Java servelt效率更高、更易用、更强大、更容易移植、更安全、也更廉价。
1、效率应用传统的CGI,针对每个HTTP请求都用启动一个新的进程。
如果CGI程序自身相对比较简短,那么启动进程的开销会占用大部分执行时间。
而使用servelt,Java 虚拟机会一直运行,并用轻量级的Java线程处理每个请求,而非重量级的操作系统进程。
类似地,应用传统的CGI技术,如果存在对同一CGI程序的N个请求,那么CGI程序的代码会载入内存N次。
同样的情况,如果使用servlet则启动N个线程,单仅仅载入servlet类的单一副本。
这种方式减少了服务器的内存需求,通过实例化更少的对象从而节省了时间。
最后,当CGI程序结束对请求的处理之后,程序结束。
这种方式难以缓存计算结果,保持数据库连接打开,或是执行依靠持续性数据的其他优化。
然而,servelt会一直停留在内存中(即使请求处理完毕),因而可以直接存储客户请求之间的任意复杂数据。
2、便利Servelt提供大量的基础构造,可以自动分析和解码HTML的表单数据,读取和设置HTTP报头,处理cookie,跟踪会话,以及其他次类高级功能。
而在CGI中,大部分工作都需要我们资金完成。
另外,如果您已经了解了Java编程语言,为什么还有学校Perl呢?您已经承认应用Java技术编写的代码要比Visual Basic,VBScript或C++编写的代码更可靠,且更易重用,为什么还有倒退回去选择那些语言来开发服务器端的程序呢?3、强大Servlet支持常规CGI难以实现或根本不能实现的几项功能。
Servlet能够直接于Web服务器对话,而常规的CGI程序做不到这一点,至少在不使用服务器专有API 的情况下是这样。
例如,与Web服务器的通信使得讲相对URL转换成具体的路径名变得更为容易。
多个servelt还可以共享数据,从而易于实现数据库连接共享和类似的资源共享优化。
Servelt还能维护请求之间的信息,使得诸如会话跟踪和计算结果缓存等技术变得更为简单。
4、可移植性Servelt使用Java编程语言,并且遵循标准的API。
所有主要的Web服务器。
实际上都直接或通过插件支持servlet。
因此。
为Macromedia JRun编写的servlet,可以不经过任何修改地在Apache Tomcat,Microsoft Internet Information Server,IBM WebSphere 。
iPlanet Enterprise Server。
Oracle9i AS 或者StrNine WebStar 上运行。
他们是java2平台企业版的一部分,所以对servlet的支持越来越普遍。
5、廉价对于开发用的网站、低容量或中等容量网站的部署,有大量免费或极为廉价的Web服务器可供选择。
因此,通过使用servelt和jsp,我们可以从免费或廉价的服务器开始,在项目获得初步成功后,在移植到更高性能或高级管理工具的昂贵的服务器上。
这与其他CGI方案形成鲜明的对比,这些CGI方案在初期都需要为购买专利软件包投入大量的资金。
价格和可移植性在某种程度上是相互关联的。
例如,Marty记录了所有通过电子邮件向他发送问题的读者的所在国。
印度接近列表的顶端,可能仅次于美国。
Marty 曾在马尼拉讲授过jsp和servlet培训课程,那儿对servelt和jsp技术抱很大的兴趣。
那么,为什么印度和菲律宾都对这项技术着呢感兴趣呢?我们推测答案可能分两部分。
首先,这两个国家都拥有大量训练有素的软件开发人员。
其次,这两个国家的货币对美元的汇率都极为不利。
因此,从美国公司那里购买专用Web服务器会消耗掉项目的大部分前期资金。
但是,使用servlet 和JSP,他们能够从免费的服务器开始:Apache Tomcat。
项目取得成功之后,他们可以转移到性能更高、管理更容易,但需要付费的服务器。
他们的servelt和jsp不需要重写编写。
如果他们的项目变得更庞大,他们或许希望转移到分布式环境。
没有问题:他们可以转而使用Macromedia JRun Professional,该服务器支持分布式应用。
同样,他们的servelt和jsp没有任何部分需要重写。
如果项目变得极为庞大,错综复杂,他们或许希望使用Enterprise JavaBeans来封装他们的商业逻辑。
因此,他们可以切换到BEA WebLogic或Oracle9i AS。
同样,不需要对servlet和jsp做出更改。
最后,如果他们的项目变得更庞大,他们或许将他从Linux转移到运行IBM WebSphere的IBM大型机上。
他们还是不需要做出任何更改。
6、安全传统CGI程序中主要的漏洞来源之一就是,CGI程序常常由通过的操作系统外壳来执行。
因此,CGI程序必须仔细地过滤掉那些可能被外壳特殊处理的字符,如反引导和分号。
实现这项预防措施的难度可能超出我们的想象,在广泛应用的CGI库中,不断发现由这类问题引发的弱点。
问题的第二个来源是,一些CGI程序用不自动检查数组和字符串边界的语言编写而成。
例如,在C和C++中,可以分配一个100个元素的数组,然后向第999个“元素“写入数据——实际上是程序内存的随机部分,这完全合法。
因而,如果程序员忘记执行这项检查,就会将系统暴露在蓄意或偶然的缓冲区溢出攻击之下。
Servelt不存在这些问题。
即使servelt执行系统调用激活本地操作系统上的程序,它也不会用到外壳来完成这项任务。