JSP&Struts In Action使用领先的Java框架构建Web应用
1.1本书目的
本书的目的是帮助Web 应用开发者能够最好的使用Strutsweb 应用框架。Struts 是一个开源软件,有助于开发者更加快速和容易地建立Web 应用程序。Struts 依靠 绝大多数开发者已熟知的标准技术—比如JavaBeans, Java servlet, 以及 JavaServer Page (JSP)。通过基于标准的技术,“填空式”的软件开发方法,Struts 可以减轻在创建新项目时 那些令人抱怨的极费时间的工作。
1.2. 谁创建了Struts软件?
Struts 是Apache 软件基金下Jakarta 项目子项目。除Struts 之外, 还有其他成功的开源产 品,包括Tomcat, Ant, 和 Velocity。 开始的代码基础从2000 年5 月开始开发,直到2001 年6 月,1.0 版本发布。有 30 多个开发者参与进来,并有数千人参与到讨论组中。Struts 代码基础由一个志愿者团队来管理。
到 2002 年,Struts 小组共有9 个志愿者参与。Struts 框架的主要架构设计和开发者是Craig R. McClanahan。Craig 也是Tomcat 4 的主要架构师,以及Java Web Services Developer Pack 的主要架构师和实现者。他现在是Sun的JavaServer Faces (JSR-127) 以及J2EE 平台的Web 层架构的规范领导。Struts 在Apache 软件许可 [ASF, License]下对公众是免费的。 使用此软件没有任何获得和再现成本。不象其他一些开源许可协议,Apache 软件许可对商业用途是友好的。你可以在你的商业项目中使用Struts,并自由分发Struts 库。你也可以将Struts 组件集成到你的框架中,就像他们是你自己编写的一样。详细情况.
1.3 为什么Struts 要开源?
现在有许多非常优秀Java 程序和框架都是开源项目。有许多的开发人员为这些项目工作,他们同时又在诸如 IBM, Sun Microsystems, 以及 Apple 这样的公司从事其日常工作。这类软件的开发式协作 利于整个软件市场。今天,许多开源组件都集成到商业产品之中。公司可以向其客户出售其专业的文档,保证支持服务水平,以及其他有价值的售后服务和增值服务。当软件是自由的时候,对市场来说它更易得到支持。Struts 就是个典型例子。虽然它还只是个很新的产品,也已经有很多文章和教程涉及到它,但却还没有什么象样的书籍。许多开发团队不喜欢使用不是自己内部开发的软件。开源组件提供了所有自行开发的软件的优点,但绝不会将你锁定在一个只有你们团队才懂的专有解决方案上。开源软件对所有人都是双赢的。
1.4 为什么叫Struts?
这个框架之所以叫“Struts”,是为了提醒我们记住那些支撑我们房屋,建筑,桥梁,甚至我们踩高跷时候的支撑。 这也是一个对Struts 在开发Web 应用程序中所扮演的角色的精彩描述。当建立一个物理建筑时,建筑工程师使用支柱为建筑的每一层提供支持。同样,软件工程师使用Struts 为业务应用的每一层提供支持。Struts in Action 中文版 Lastest Revised: July 11, 2005
1.5 什么是应用框架?
框架(framework)是可重用的,半成品的应用程序,可以用来产生专门的定制程序[Johnson]。象人一样,软件应用的相似性比不同点要多。它们运行在相似的机器上,期望从相同的设备输入信息,输出到相同的显示设备,并且将数据存储到相同的硬盘设备。开发传统桌面应用的开发人员习惯于那些可以覆盖应用开发同一性的工具包和开发环境。构架在这些公共基础上的应用框架可以为开发人员提供可以为他们的产品提供可重用服务的基础架构。框架开发人员提供一系列具有以下特征的骨架组件:
已经知道它们在其它程序上工作的很好;
它们随时可以在下一个项目中使用;
它们可以被组织的其它团队使用;
对于框架是典型的构建还是购买命题。如果你自己构建它,在你完成时你就会理解它,但是在你被融入之前又将花费多长时间呢?如果要购买,你必须得克服学习曲线,同样,在你可以用它进行工作之前又得花多长时间?这里没有所谓正确答案,但许多观察者都会同意,象Struts 这样的框架能提供比从头开始开发更显著的投资回报,特别是对于大型项目来说。其它类型的框架框架的概念不仅用于应用程序也可用于组件。通过此书,我们也介绍其他可以和Struts 一起使用的框架。这些包括 Lucene 搜索引擎,Scaffold 工具包,Struts 验证器,以及Tiles标签库。与应用框架一样,这些工具也提供了一些半完成的版本,可以用在用户的定制组件之中。某些框架被限制于专门的开发环境中。Struts 以及本书中涉及的组件却不是这样。你可以在很多环境中来开发Struts: Visual Age for Java, JBuilder, Eclipse, Emacs, 甚至使用Textpad 。对于你的工具,如果你可以用来开发Java, 你就可以用它来开发Struts1。使用Struts 的应用开发使用了大量的其他基础技术。这些技术并不是专门针对Struts ,而是所有Java web 应用都可以使用的。开发者使用Struts 之类的框架是为了隐藏在诸如HTTP, CGI,以及JSP 之类技术后面的繁琐的细节。作为一个Struts 开发者,你并不需要知晓所有的相关知识,但是这些基本技术的工作原理可能有助于你针对棘手问题设计出创造性的方案。如果你已经非常熟悉这些技术,你可以跳过这些章节到1.4 节。
.............................................此处省略若干字
附录A 外文翻译-原文部分
JSP&Struts in ActionBuilding web applicationswith the leading Java framework
1.1 What is this book about?
We wrote this book to help web developers make the best possible use of the Struts web application framework. Struts is open source software that helps developers build web applicationsquickly and easily. Struts relies on standard technologies—such as JavaBeans, Java servlets, and JavaServer Pages (JSP)—that most developers already know how to use. By taking a standards-based, “fill-in-the-blanks” approach to software development, Struts can alleviate much of the time-consuming grunt work that comeswith every new project.
1.2 Who makes the Struts software?
Struts is hosted by the Apache Software Foundation (ASF) as part of its Jakarta project. Besides Struts, Jakarta hosts several successful open source products, including Tomcat, Ant, and Velocity. The initial Struts codebase was developed between May 2000 and June 2001 when version 1.0 was released. More than 30 developers contributed to the Struts distribution, and thousands more follow the Struts mailing lists. The Struts codebase is managed by a team of volunteer “Committers.” By 2002, the Struts team included nine active Committers. The primary architect and developer of the Struts framework is Craig R. McClanahan. Craig is also the primary architect of Tomcat 4 and the implementation architect of the Java Web Services Developer Pack. He is now Sun’s specification lead for JavaServer Faces (JSR-127) as well as the Web Layer Architect for the Java 2 Enterprise Edition (J2EE) platform. Struts is available to the public at no charge under the Apache Software License [ASF, License]. There are no acquisition or other recurring costs for using the software. Unlike some other open source licenses, the Apache Software License is business-friendly. You can use Struts to create a commercial project and distribute the Struts binary without any red tape, fees, or other hassles. You can also integrate the Struts components into your own framework just as if they were
written in-house. For complete details, see the Apache Software License at www.apache.org/LICENSE.
What are application frameworks?
1.3 Why is Struts open source?
Most of the leading Java utilities and frameworks are now open source projects. Many of the developers working on these projects do so as part of their regular jobs with companies like IBM, Sun Microsystems, and Apple. Collaborating openly on this type of software benefits the entire marketplace. Today, many open source components are integrated into commercial products. Companies then sell professional documentation, guaranteed support levels, and other valuable aftermarket services to their clients. When software is freely available, it becomes much easier for the marketplace to support. Struts is a prime example of this. Although still a youngster, it has already been featured in dozens of articles and seminars, not to mention books like this one. Many development teams do not like to use software that was not “invented” in-house. Open source components provide all the benefits of writing the same software in-house but do not lock you into a proprietary solution that only your team understands. Open source frameworks are a win-win for everyone.
1.4 Why is it called Struts?
The framework is called “Struts” to remind us of the invisible underpinnings that hold up our houses, buildings, bridges, and, indeed, ourselves when we are on stilts. This is an excellent description of the role Struts plays in developing web applications. When raising physical structures, construction engineers use struts to provide support for each floor of a building. Likewise, software engineers use Struts to support each layer of a business application.
.............................................此处省略若干字