毕业论文外文翻译-MySQL和JSP的Web应用程序.docx

上传人:豆**** 文档编号:29955205 上传时间:2022-08-02 格式:DOCX 页数:17 大小:57.01KB
返回 下载 相关 举报
毕业论文外文翻译-MySQL和JSP的Web应用程序.docx_第1页
第1页 / 共17页
毕业论文外文翻译-MySQL和JSP的Web应用程序.docx_第2页
第2页 / 共17页
点击查看更多>>
资源描述

《毕业论文外文翻译-MySQL和JSP的Web应用程序.docx》由会员分享,可在线阅读,更多相关《毕业论文外文翻译-MySQL和JSP的Web应用程序.docx(17页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、中原工学院信息商务学院毕业设计(论文)译文专用纸 第17 页MySQL和JSP的Web应用程序JSP开发人员构建Web应用程序时遇到需要强大的数据库连接的特殊问题。 MySQL和JSP的Web应用程序解决了构建数据驱动的应用程序JavaServer页面上的发展模式为基础的挑战。 MySQL和JSP的Web应用程序开始一个对JSP数据库开发 - JavaServer页面,JDBC和数据库模式所需的核心技术概述。该书然后概述并提出了互联网商业应用演示,如接收和处理用户输入,设计和实施业务规则,并平衡服务器上的用户负载的概念。通过JDBC(Java数据库连接),开发人员能够与大多数商业数据库如Ora

2、cle进行沟通。在MySQL和JSP的Web应用中心提交了一份关于开源工具MySQL和Tomcat的解决方案,使读者一个经济实惠的方式来测试书中的例子的应用程序和试验。那么JSP是怎么一回事呢?如果您符合上述要求的,你对这个问题的答案应该已经有一个相当不错的理解。 JSP是所有关于做高度面向对象的网站,可以利用所有的现代软件工程最佳实践。这些做法包括诸如SQL数据库和基于UML设计的东西。这并不是说JSP是万能的而且使用它会自动将您的网站上的工程艺术的典范。这只是尽可能地用其他任何技术用JSP设计不良网站。这就是为什么,当你详细检查文本的时候,你会看到如何合并最佳方法以及项目得到的压力时候如何

3、避免方便的陷阱。JSP它本身就是从第一个静态Web服务器开始的一个沿路径循序渐进的步骤,通过CGI移动功能的服务器,最后脚本功能的服务器的第一代。 JSP是一个比Java引擎能够熟悉网页的的少了一个Java组件的Web服务器。JSP是由Java servlet发展演变而来的。servlet允许开发人员处理传入使用Java程序能够访问的所有正常的信息,一个共同的网关接口(CGI)程序将Web请求。此外,该servlet可以访问会话持久对象。这是Java的都与一个特定的用户会话,可用于存储请求之间的状态对象。 Servlet编程是一个允许开发人员编写结构良好的模块化的Web应用程序使用面向对象语言

4、的重要一步。它还解决了状态持久性的问题,用户和应用程序执行的一个动作或一系列动作期间让更多的信息驻留在服务器上而且较少的反复在用户和服务器之间传递。 Servlet还遭受一大问题。因为他们最终需要输出HTML中,HTML编码必须被嵌入在servlet代码中。导致如下所示的一段代码片段:Out.println(nnThank you for Registeringn); Out.println(); 当你编码很多网页时,这种嵌入式是非常古老非常快的。此外,必须避免所有引号会导致的很多混乱和如果你遗漏了一个反斜杠带来难以发现的错误。最终,一个较好的方法出现。假设你能结合最好的静态HTML页面和se

5、rvlet的交互能力。其结果是JavaServer页面(在微软方面,结果是活动服务器页面)。JSP是非常复杂强大的。在接下来的章节中,你会通过这个细节流程,但就目前而言,这里是主要的步骤:1、接到请求时从使用普通的HTTP请求格式的浏览器。2、WEB服务器切换到JSP的请求,JSP着眼于找到合适的JSP文件。3、.jsp文件转换成.Java文件,包含Java代码,将创建一个类,它的名称是从.jsp的文件名而得。4、JSP然后用javac编译.java文件产生一个.class文件。注意如果一个.class文件已经存在而且比.jsp文件新则可以跳过先前的两步。5、一个新创建的类实例被实例化,并发送

6、_jspService消息。6、新的实例看看是否已经有一个被称为user的stuff.User对象实例在当前连接的用户会话对象的空间存在。如果没有,一个实例被实例化。7、作为服务stuff.jsp的一部分,user实例将被GetUserName()方法调用。8、如果JSP处理需要访问数据库中的信息,它将使用JDBC来进行连接和处理SQL请求。正如你可以看到,巨大的能量是在现有的JSP世界里。开发者可以自由编写大多数看起来像HTML的Web页面,除非到Java标注是要求最喜欢看的HTML。但是,在同一时间,他们可以自由地充分发展充实面向对象的应用程序使用Java会带来负担的所有功能。他们也得到s

7、ervlet的所有优点,包括会话持久性。为什么我们需要的数据库?好,一个原因就是为了让拉里埃里森想到比尔盖茨的时候,他的Oracle有能力保持自己百忧解。更严重的回答是相同的原因也就是驾驶人先按下针对一块湿粘泥:因为把事情记下来是好的。 Web服务器是了不起的创造,但他们是一个有点像白痴专家。请他们为一个网页或运行Java的一段,他们表演的像一个冠军。但开始要求他们记住他们五分钟前做了什么,和他们显露的比一个肥皂剧里的人物失忆还快。第一个也是最重要的原因是你使用的数据库是有大量的数据在电子商务交易里,你必须记住并跟踪:一个用户的姓名,地址,信用卡和其他信息以前进入了一个注册页面帽子的用户可能把

8、以前留下交易放进购物车哪些物品有存货,以及它们的价格,描述等等订单需要履行,订单已发货,并已待补物品。现在,你可以存储所有这些信息在服务器上的硬盘平面文件中,但也有你想保存的数据的其他重要属性:如果交易部分失败,您希望能够收回交易。您希望能够找到Web服务器安全的地方定位数据,这可能是完全在DMZ或外部的防火墙。您希望能够如用户数据或产品快速访问数据,即使有数千或上百万数据。当你添加这些项目的购物清单,只有一个关系数据库才会真正的影响工作效率。MySQL 许多网站不需要Oracle的历史优势(和价格标签)。 MySQL是一个开源SQL数据库可供任何人使用,拥有许多(尽管不是全部)的先前数据库的

9、功能,如Oracle。MySQL是可用于几乎所有的电脑上有相当好的能力是相当轻量级的处理器,安装方便(10分钟,而不像Oracle需要多个小时)。所以,也许你想知道,有什么收获?没有得到什么,你在MySQL中,使人们把目光转向到Oracle?那么,MySQL是一个不错的小程序包,但它缺少一些东西,不然会是不错的一个完美的世界。一个主要特点就是MySQL不提供数据库一致性检查。您可以使用您的模式外键的标签,但MySQL会忽略它们。据我所知许多数据库管理员会认为这是一个很糟糕的事情。外键约束防止你创建数据不一致。例如,假设你有一个像这样的数据库表:CREATE TABLE USER ( USERI

10、D INTEGER, FIRST_NAME VARCHAR(80), LAST_NAME VARCHAR(80); CREATE TABLE PURCHASE ( USERID FOREIGN KEY USER(USERID), ITEM INTEGER, QUANTITY INTEGER); 在诸如Oracle的数据库里,如果你创建了一个在PURCHASE 表ID为3的用户输入数据库,在USER表里可能已经有一个ID为3的用户或错误会发生。同样,如果它在PURCHASE理是作为参考,你就不能从表USER里删除ID为3的用户,MySQL的人们做了一个漂亮慷慨激昂的论点关于在各自的文档进行数据的

11、完整性取决于外键是无论如何都是一个坏主意,但是说服你的这种哲学的DBA是很可能沦为一个宗教辩论,此外,其他一些功能缺失,如子查询和SELECT INTO。但可能是其他主要功能,你会漏掉回滚/提交的功能。 MySQL不会执行回滚和为某些特殊类型的表提交,但他们并不全是。同样,MySQL的人提供他们自己的难题为什么MySQL是好的,但能够回滚事务是(在我看来)重要以确保您有可用。 回滚可以在开始做一系列交易之前在数据库设置一个保存点,并能要么回滚到原来的状态或提交在结束时候的改变。例如,当记录一次购买,你需要记录一个针对用户的帐户扣款,并输入到shipping表记录,让你知道后来ship的项目。比

12、方说,第二部分失败。你不会要收取用户,但没有ship的项目。因此,你要回滚到事务开始之前的状态。 因此,MySQL不是一个成熟的数据库产品,至少,还不是。它对于世界上90% 的电子商务网仍然是相当好的,但是,4.0版本在撰写本文时最初的版本,解决了这些问题,包括行级锁定和事务控制数量。把Tomcat和MySQL的结合Tomcat和MySQL的结合为你用它来学习、开发和部署JSP应用程序提供了一个强大的、可靠的和免费的平台。而且,最好的是,您开发的代码将使用这个平台很好地运行使用iPlanet和Oracle或WebSphere和SQL Server。作为一个学习工具,两者的结合几乎是“参考实现“

13、他们(JSP和SQL)各自的协议。因此,当你熟悉了解项目的详细情况时,你不会接到任何恶劣的厂商专有的坏习惯。此外,你可以享受你正在支持开源软件活动的知识。开放源码软件是根据多个公共许可证的编码,往往是GNU通用公共许可证(GPL)的人免费提供。关于GPL的实际情况和虚构GNU通用公共许可证可能是现存最被歪曲的文件之一,基础知识分解如下: 1.如果您在GPL下放置一个软件作品,任何人都可以免费复制它,无论以源码或可执行形式或者把它交给其他任何人。 2.如果你在GPL下一个软件,并以此作为你的作品的一部分,你不能收取费用超出复制的产品。 许多人解释这意味着他们不能使用GPL软件用于商业目的。没有什

14、么是更远离真理。你不能做的是对大量的来源于GPL产品作为你的产品的部分收取费用。 你可以在一个网站开发免费地使用GPL代码,因为你不卖自己的网站作为一个产品给第三方。 (咨询公司陷入一个不可思议的空间,但至今没有人以便使用GPL而追逐它们。)为什么支持这项活动是很好的?对于这个问题的答案有两点:一个是技术的和一个政治的。从技术上讲,这是一件好事,因为开源软件往往鼓励如JSP和JDBC开放标准的开发,让您从一个更大的群体里去选择你的工具,而不是被锁定成为一个厂商的专有解决方案。从政治上来说这是一个积极的事,因为它保持政治上的大公司的诚实。 WebLogic和iPlanet必须保持竞争力的和响应,

15、因为他们知道,有一个免费的解决方案在那里,如果他们不这样。而当你使用开源软件,你发送一条消息,你的首要问题是他们的特点和可靠性,如果出现错误,没有一个大公司提起诉讼。原文出处MySQL and JSP Web applications 作者:James TurnerMySQL and JSP Web applicationsJSP developers encounter unique problems when building web applications that require intense database connectivity. MySQL and JSP Web App

16、lications addresses the challenges of building data-driven applications based on the JavaServer Pages development model. MySQL and JSP Web Applications begins with an overview of the core technologies required for JSP database development-JavaServer Pages, JDBC, and the database schema. The book the

17、n outlines and presents an Internet commerce application that demonstrates concepts such as receiving and processing user input, designing and implementing business rules, and balancing the user load on the server. Through the JDBC (Java DataBase Connector), the developer can communicate with most c

18、ommercial databases, such as Oracle. The solutions presented in MySQL and JSP Web Applications center on the open source tools MySQL and Tomcat, allowing the reader an affordable way to test applications and experiment with the books examples.So What Is JSP All About? If you meet the requirements me

19、ntioned, you should already have a pretty good idea what the answer to this question is. JSP is all about doing highly object-oriented Web sites that can leverage all the best practices of modern software engineering. These practices include things such as SQL databases and UML-based design. This is

20、nt to say that JSP is a cure-all and that using it will automatically make your Web site a paragon of engineering art. Its just as possible to design bad Web sites in JSP as with any other technology. Thats why, as you go through the text, you will see how to incorporate the best practices and how t

21、o avoid the pitfalls of convenience when projects get stressful. JSP itself is an evolutionary step along the path that started with the first static Web servers, moved through CGI-enabled servers, and finally the first generation of script-enabled servers. JSP is less a Web server with a Java compo

22、nent than it is a Java engine that understands the Web.JSP grew out of Java servlets. Servlets allow the developer to handle the incoming Web requests using a Java program that has access to all the normal information that a Common Gateway Interface (CGI) program would. In addition, the servlet has

23、access to session-persistent objects. These are Java objects that are associated with a specific user session and can be used to store state between requests. Servlet programming was a major step forward in allowing developers to write well-structured modular Web applications using an object-oriente

24、d language. It also solved the problem of state persistence, allowing more information to reside on the server during a transaction and less to have to pass back and forth between the user and the server. Servlets still suffered from one major problem. Because they eventually need to spit out HTML,

25、the HTML coding had to be embedded in the servlet code. This led to code fragments like the one shown here: Out.println(nnThank you for Registeringn); Out.println(); This kind of embedding gets very old very fast when you have to code a lot of pages. In addition, having to escape all of the quotatio

26、n marks can lead to a lot of confusing and hard-to-find errors if you leave out a backslash. Eventually, a still-better idea emerged. Suppose that you could combine the best of static HTML pages and with the interactive capabilities of servlets. The result was JavaServer Pages (on the Microsoft side

27、, the result was Active Server Pages). As Figure I.1 shows, JSP is a complicated beast. In the next chapter, youll walk through this flow in detail, but for the moment, here are the major steps: 1. A request comes in from a browser using the normal HTTP request format. 2. The Web server hands off th

28、e request to JSP. JSP looks at the filename and finds the appropriate JSP file. 3. The .jsp file is converted into a .java file, containing Java code that will create a class whose name is derived from the .jsp filename. 4. JSP then compiles the .java file using javac to produce a .class file. Note

29、that the two previous steps are skipped if a .class file already exists and is newer than the .jsp file. 5. An instance of the newly created class is instantiated and sent the _jspService message. 6. The new instance looks to see if there is already an instance of the stuff.User object called user e

30、xisting in the session object space for the currently connected user. If not, one is instantiated.7. As part of servicing stuff.jsp, the user instance is called with the getUserName() method. 8. If the JSP processing requires access to information in a database, it uses JDBC to make the connection a

31、nd handle the SQL requests.As you can see, a tremendous amount of power is available in the JSP world. Developers are free to write Web pages that look mostly like HTML, except where callouts to Java are required. But, at the same time, they are free to develop fully fleshed-out object-oriented appl

32、ications using all the features that Java can bring to bear. They also get all the benefits of servlets, including session persistence.Why Do We Need Databases?Well, one reason is so that Larry Ellison of Oracle can afford to keep himself on Prozac when he thinks about Bill Gates. A more serious ans

33、wer is the same reason that drove man to first press a stick against a piece of wet mud: because its good to write things down. Web servers are marvelous creatures, but theyre a bit like idiot savants. Ask them to serve a Web page or run a piece of Java, and they perform like a champ. But start aski

34、ng them to remember what they did five minutes ago, and they develop amnesia faster than a character in a soap opera.The first and most important reason that you use databases is that theres a lot in an e-commerce transaction that you need to remember and track: A users name, address, credit card, a

35、nd other information previously entered on a registration page hat the user might have put into a shopping cart and left from a previous transaction What items are in stock, along with their price, description, and so on Orders that need to be fulfilled, orders that have been shipped, and items that

36、 have been backordered .Now, you could store all this information in a flat file on the servers hard disk, but there are other important properties that you want to have for this data: You want to be able to back out a transaction if part of it fails. You want to be able to locate the data somewhere

37、 more secure than the Web server, which could be in a DMZ or outside the firewall altogether. You want to be able to access data such as user data or products quickly, even if there are thousands or millions of them.When you add these items to the shopping list, only a relational database will reall

38、y do the job effectively.MySQL Many sites dont need the battleship strength (and price tag) of Oracle. MySQL is an open-source SQL database available for anyone to use, with many (although not all) of the features of its big brothers, such as Oracle. MySQL is available for just about any computer th

39、at has decent powerit is fairly lightweight on the processor and easy to install (10 minutes, as opposed to multiple hours for Oracle). So, perhaps you are wondering, whats the catch? What are you not getting in MySQL that makes people turn to Oracle? Well, MySQL is a neat little package, but it is

40、missing some things that would be nice to have in a perfect world. A major feature that MySQL does not offer is database consistency checking. You can use foreign key tags in your schema, but MySQL cheerfully ignores them. A lot of DB As I know would consider this a very bad thing.A foreign key cons

41、traint prevents you from creating inconsistent data. For example, lets suppose that you had a scheme that looked like this: CREATE TABLE USER ( USERID INTEGER, FIRST_NAME VARCHAR(80), LAST_NAME VARCHAR(80); CREATE TABLE PURCHASE ( USERID FOREIGN KEY USER(USERID), ITEM INTEGER, QUANTITY INTEGER); In

42、a database such as Oracles, if you created an entry in the PURCHASE table with a user ID of 3, there would have to already be a user ID of 3 in the USER table or an error would occur. Similarly, you couldnt delete user 3 from USER if it was referenced in PURCHASE.The MySQL folks make a pretty impass

43、ioned argument in their documentation that depending on foreign keys for data integrity is a bad idea anyway, but convincing your DBA of this philosophy is likely to degrade into a religious debate. In addition, some other features are missing, such as subselects and select into. But probably the ot

44、her major piece that you will miss is the rollback/commit functionality. MySQL does implement rollback and commit for certain types of tables, but not all of them. Again, the MySQL folks offer their own spin on why this is okay, but being able to roll back transactions is (in my opinion) important e

45、nough to make sure that you have it available. Rollback allows you to set a savepoint on the database before starting to do a series of transactions with it, and be able to either roll back to the original state or commit the changes at the end. For example, when recording a purchase, you need to re

46、cord a debit against the users account and enter a record into the shipping table so that youll know later to ship the item. Lets say that the second part fails. You wouldnt want to charge the user but not ship the item. Thus, youd want to roll back to the state before the transaction began.So, MySQ

47、L isnt a full-blown production databaseat least, not yet. Its still good enough for probably 90% of the e-commerce sites in the world, however. And version 4.0, which is in alpha as of this writing, addresses a number of these concerns, including row-level locking and transaction control.Putting Tomcat and MySQL TogetherCombining Tomcat and MySQL provides a powerful, reliable, and free platform that you can use to learn, develop, and deploy JSP applications. And, best of all, the code that you develop using this platform will run nicely using iPlanet and Oracle or WebSphere and SQ

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 教育专区 > 小学资料

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号© 2020-2023 www.taowenge.com 淘文阁