外文翻译--MySQL和JSP的Web应用程序(2)

2019-05-27 21:28

能,你会漏掉回滚/提交的功能。 MySQL不会执行回滚和为某些特殊类型的表提交,但他们并不全是。同样,MySQL的人提供他们自己的难题为什么MySQL是好的,但能够回滚事务是(在我看来)重要以确保您有可用。

回滚可以在开始做一系列交易之前在数据库设置一个保存点,并能要么回滚到原来的状态或提交在结束时候的改变。例如,当记录一次购买,你需要记录一个针对用户的帐户扣款,并输入到shipping表记录,让你知道后来ship的项目。比方说,第二部分失败。你不会要收取用户,但没有ship的项目。因此,你要回滚到事务开始之前的状态。

因此,MySQL不是一个成熟的数据库产品,至少,还不是。它对于世界上90% 的电子商务网仍然是相当好的,但是,4.0版本在撰写本文时最初的版本,解决了这些问题,包括行级锁定和事务控制数量。

把Tomcat和MySQL的结合

Tomcat和MySQL的结合为你用它来学习、开发和部署JSP应用程序提供了一个强大的、可靠的和免费的平台。而且,最好的是,您开发的代码将使用这个平台很好地运行使用iPlanet和Oracle或WebSphere和SQL Server。

作为一个学习工具,两者的结合几乎是“参考实现“他们(JSP和SQL)各自的协议。因此,当你熟悉了解项目的详细情况时,你不会接到任何恶劣的厂商专有的坏习惯。

此外,你可以享受你正在支持开源软件活动的知识。开放源码软件是根据多个公共许可证的编码,往往是GNU通用公共许可证(GPL)的人免费提供。

关于GPL的实际情况和虚构 GNU通用公共许可证可能是现存最被歪曲的文件之一,基础知识分解如下: 1.如果您在GPL下放置一个软件作品,任何人都可以免费复制它,无论以源 码或可执行形式或者把它交给其他任何人。 2.如果你在GPL下一个软件,并以此作为你的作品的一部分,你不能收取费 用超出复制的产品。 许多人解释这意味着他们不能使用GPL软件用于商业目的。没有什么是更远 离真理。你不能做的是对大量的来源于GPL产品作为你的产品的部分收取费用。 你可以在一个网站开发免费地使用GPL代码,因为你不卖自己的网站作为 一个产品给第三方。 (咨询公司陷入一个不可思议的空间,但至今没有人以便 使用GPL而追逐它们。) 为什么支持这项活动是很好的?对于这个问题的答案有两点:一个是技术的和一个政治的。从技术上讲,这是一件好事,因为开源软件往往鼓励如JSP和JDBC开放标准的开发,让您从一个更大的群体里去选择你的工具,而不是被锁定成为一个厂商的专有解决方案。从政治上来说这是一个积极的事,因为它保持政治上的大公司的诚实。 WebLogic和iPlanet必须保持竞争力的和响应,因为他们知道,有一个免费的解决方案在那里,如果他们不这样。而当你使用开源软件,你发送一条消息,你的首要问题是他们的特点和可靠性,如果出现错误,没有一个大公司提起诉讼。

原文出处《MySQL and JSP Web applications 》作者:James Turner

MySQL and JSP Web applications

JSP developers encounter unique problems when building web applications that require intense database connectivity. MySQL and JSP Web Applications 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 then 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 commercial 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 book's examples. So What Is JSP All About?

If you meet the requirements mentioned, 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 isn't to say that JSP is a cure-all and that using it will automatically make your Web site a paragon of engineering art. It's just as possible to design bad Web sites in JSP as with any other technology. That's why, as you go through the text, you will see how to incorporate the best practices and how to 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 component 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 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-oriented 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, the HTML coding had to be embedded in the servlet code. This led to code fragments like the one shown here:

Out.println(\ Registering\\n\ Out.println(\

SRC=\\\

WIDTH=200

HEIGHT=100

ALIGN=\\\”>\

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 quotation 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, the result was Active Server Pages). As Figure I.1 shows, JSP is a complicated beast. In the next chapter, you'll 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 the 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 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 existing 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 and 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 applications 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 answer is the same reason that drove man to first press a stick against a piece of wet mud: because it's good to write things down. Web servers are marvelous creatures, but they're 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 asking 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 there's a lot in an e-commerce transaction that you need to remember and track:

?A user's name, address, credit card, and other information previously entered on a registration page


外文翻译--MySQL和JSP的Web应用程序(2).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:广中医-卫生统计学补充练习题

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: