`

AppFuse: Start Your J2EE Web Apps (中英文对照)

阅读更多

1  AppFuse: 开始你的 J2EE web 应用

by Matt Raible
<chsdate w:st="on" year="2004" month="7" day="15" islunardate="False" isrocdate="False">07/15/2004</chsdate>


<shapetype id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"> <stroke joinstyle="miter"> <formulas> <f eqn="if lineDrawn pixelLineWidth 0"> <f eqn="sum @0 1 0"> <f eqn="sum 0 0 @1"> <f eqn="prod @2 1 2"> <f eqn="prod @3 21600 pixelWidth"> <f eqn="prod @3 21600 pixelHeight"> <f eqn="sum @0 0 1"> <f eqn="prod @6 1 2"> <f eqn="prod @7 21600 pixelWidth"> <f eqn="sum @8 21600 0"> <f eqn="prod @7 21600 pixelHeight"> <f eqn="sum @10 21600 0"> </formulas> <lock v:ext="edit" aspectratio="t"> </shapetype> <shape id="_x0000_i1025" style="WIDTH: 7.5pt; HEIGHT: 0.75pt" type="#_x0000_t75" alt=""> <imagedata src="file:///C:\DOCUME~1\lesky\LOCALS~1\Temp\msohtml1\01\clip_image001.png" o:href="http://today.java.net/im/a.gif"> </shape>

<shape id="_x0000_i1026" style="WIDTH: 7.5pt; HEIGHT: 0.75pt" type="#_x0000_t75" alt=""> <imagedata src="file:///C:\DOCUME~1\lesky\LOCALS~1\Temp\msohtml1\01\clip_image001.png" o:href="http://today.java.net/im/a.gif"> </shape>

 

 

 

 

 

<shape id="_x0000_i1027" style="WIDTH: 7.5pt; HEIGHT: 0.75pt" type="#_x0000_t75" alt=""> <imagedata src="file:///C:\DOCUME~1\lesky\LOCALS~1\Temp\msohtml1\01\clip_image001.png" o:href="http://today.java.net/im/a.gif"> </shape>

One of the hardest parts about J2EE development is getting started. There is an immense amount of open source tools for web app development. Making a decision on which technologies to use can be tough -- actually beginning to use them can be even more difficult. Once you've decided to use Struts and Hibernate, how do you go about implementing them? If you look on the Hibernate site or the Struts site, you'll probably have a hard time finding any information on integrating the two. What if you want to throw Spring into the mix? As a developer, the best way for me to learn is by viewing sample apps and tutorials that explain how to extend those applications. In order for me to learn (and remember) how to integrate open source technologies such as Hibernate, Spring, Struts, and Ant/XDoclet, I created AppFuse. The beauty of AppFuse is you can actually get started with Hibernate, Spring, and Struts without even knowing much about them. Using test-driven development, AppFuse and its tutorials will show you how to develop a J2EE web application quickly and efficiently.

J2EE 开发来说,起步是一件最困难的事情之一。对于巨大数量的开源技术来说,决定选择哪些技术可能是很困难的 实际上,对于他们的上手可能更加困难。假设你选择了 Struts Hibernate, 那么你如何去在一起使用他们。即使你去查找 Hibernate 主站或者 Struts 主站,你仍然难以找到关于如何整合两者的信息。假如你又再打算整合 Spring 又会如何?作为一个开发者,我认为最好的学习方法是浏览简单的示例程序和指南来解释如何扩展这些程序。为了我能够学习和记住如何集成像 Hibernate, Spring, Struts, Ant/XDoclet 这样的开源技术,我编写了 AppFuse AppFuse 的诱人之处就是你能够即刻开始使用 Hibernate, Spring, and Struts 却无需知道很多关于它们的知识。 AppFuse 和它的指南将告诉你如何快速有效的使用测试驱动方式开发一个 J2EE web 应用程序。

 

2          The Birth of AppFuse

Appfuse 的诞生

In early 2002, I managed to land a contract where I was the lone developer. I was responsible for everything, from gathering requirements to database creation to DHTML on the web front end. While I'd done a lot of front-end work (Struts, HTML, etc.) over the years, the business layer and persistence layer were mostly new to me. So I searched and searched for J2EE patterns to do things the "right way" for my new client. I ended up implementing Business Delegates, DAOs, and ServiceLocators -- many of them modeled after J2EE Blueprints. Towards the end of that contract, I was contracted to help write a book on JSP 2.0. The publisher was Wrox Press and the book was Professional JSP 2.0. I volunteered to write two chapters -- one on Struts and one on web security. Note: in March 2003, Wrox went out of business and this book eventually became Pro JSP, Third Edition, published by Apress.
2002 年初的时候,我得到了一份个人独立开发的合同,我要负责所有的事情,包括从收集需求到数据库创建和编写 web 前端的 DHTML 。虽然我做过多年前台的工作 (Struts, HTML, 等等 ) ,但是业务层和数据持久层的很多东西对我来说是不熟悉的。于是我不断的查找各种 J2EE 模式来以“正确的方法”满足我的新客户。我最终实现了 Business Delegates, DAOs, and ServiceLocators – 很多 J2EE Blueprints 中的模型。在那个合同的最后,我被约定去帮助写一本关于 JSP2.0 的书。出版商是 Wrox Press ,这本书的名字是 Professional JSP 2.0 我志愿编写了两章――一章是关于 Struts 而另一章是关于 web 安全。

注:在 2003 3 月, Wrox 停业,最终该书 Apress 出版,名为: Pro JSP, Third Edition

When you write a technical book, it's helpful to use a sample app to demonstrate concepts. I was tired of reading books that had a throwaway sample app, so I wanted to develop something meaningful; something I could use after I was done writing. My initial thoughts were to write an application that would help you get started with Struts, and would use XDoclet to do a lot of the heavy lifting. It also had to have a lot of security features so I could use it for my chapter on web application security. I came up with the name struts-xdoclet and began developing my application.

在你编写一本技术类书籍时,使用一个简单的应用去示范一些概念是非常有效的。我对很多提供的示例程序是看后即弃的书是非常反感的,于是我决定去开发一些能够用的更久一些的程序,一些东西是我能够在我结束写作以后仍然可以使用的。我最初的想法是编写一个能够帮助你开始 struts 并利用 XDoclet 去做很多繁琐工作的应用程序。它的许多安全特性也能够用在我的“ web 应用安全性”章节中。我给它取名叫做 struts-xdoclet 并且开始编写这个程序。

After a couple of weeks, I decided that " struts-xdoclet " was too hard to say and renamed the project AppFuse. I developed the sample app for my Struts chapter using AppFuse and released it as Struts Resume. After publishing Struts Resume, I needed to extract the resume-specific stuff out of it to revert back to the generic "jumpstart" application I wanted AppFuse to be. It took me almost three months, but I finally released the first official version of AppFuse in April 2003.

过了几周以后,我认为 " struts-xdoclet " 这个名字很拗口,于是把项目改名为 AppFuse 。我为我的 Struts 章节生成了一个简单的应用并把它作为 Struts Resume 发布出去。在发布了 Struts Resume 以后,我刨除了其中和具体相关的东西使它重新成为一般的入门程序,正如我开始设想的那样。它花费了我几乎三个月的时间,但是最终我在 2003 4 月发布了 AppFuse 的第一个正式版本。

Since its initial release, AppFuse has gone through many changes and improvements. Most of the technology decisions were made from experience. It was a pain to keep my ValueObjects (VOs) and ActionForms in sync, so ActionsForms are generated using XDoclet. I found it tedious to write JDBC and more tedious to update SQL and VOs when adding new table columns. To solve this, I chose to use Hibernate for persistence and use Ant/XDoclet to dynamically create my database tables. Rather than lose my tables' data each time, I integrated DBUnit, which also came in handy when running unit tests. I decided to use Tomcat/MySQL as the default server/database setup because I was most familiar with them. I integrated a plethora of unit/integration tests so I could make sweeping changes and verify that everything still worked (including the JSPs) by running ant test-all .

自从它的第一个发布版本以来, AppFuse 已经经历了许多改变和发展。大多数的技术选择是凭经验得出的。保持 ValueObjects (VOs) ActionForms 同步是一件很痛苦的事情,于是我使用了 XDoclet 来生成 ActionsForms 。我发现编写 jsbc 代码是非常枯燥乏味的,而当更新表字段的时候修改 sql VOs 的代码是一件更枯燥的事情。为了解决这些问题,我选择使用 Hibernate 作为数据持久层并且使用了 Ant/XDoclet 来动态创建我的数据库的表。 Rather than lose my tables' data each time, 我集成了 DBUnit, which also came in handy when running unit tests. 使用 Tomcat/MySQL 作为默认的服务器和数据库是因为我最熟悉它们。我集成了所有的测试这样我能够在做出了大量改变以后运行 ant test-all 可以检查一切是否仍然可以正常工作(包括 JSP

In March of 2004, I moved the AppFuse project from the Struts project on SourceForge to java.net. I had a couple of reasons for doing this. First of all, it was a sub-project on SourceForge, and its user base was growing quickly. It needed dedicated mailing lists and forums. Secondly, java.net seemed to do a better job of marketing projects and I'd heard their CVS system was much more stable. My experience at java.net has been quite nice: it's a very stable system, and the administrators are very supportive of the project and have even helped with marketing it.

2004 4 月,我将 AppFuse 项目从 SourceForge Struts project 移到了 java.net 。我这样作有几个原因。首先是 AppFuse SourceForge 的一个子项目,它的用户基础增长的非常快,需要专门的邮件列表和论坛。第二是因为 java.net 看起来提供了更好的销售项目的工作而且我听说他们的 CVS 系统非常的稳定。我在 java.net 的经历非常的美好:他是一个非常稳定的系统。而且管理员对项目的维护和支持非常的有效。

3          What is AppFuse?

AppFuse 是什么?

So after all that history, what is AppFuse? At its very core, AppFuse is a web application that you can package into a .war and deploy to a J2EE 1.3-compliant app server. It's designed to help you create new web applications using a new target in its build.xml file. The new target allows you to specify a name for your project and a name for the database it will talk to. Once you've created a project, you can instantly create a MySQL database and deploy it to Tomcat using ant setup . Furthermore, you can verify that the basic functionality of your new application works by running ant test-all . At this point, you might sneer and say, "What's the big deal? Anyone can create a .war file and deploy it to Tomcat." I agree, but do you have a setup-tomcat target that will configure Tomcat with JNDI resources for connections pooling and mail services? Most of what AppFuse does is not rocket science. In reality, it's nothing more than a directory structure, a build file, and a bunch of base classes -- with a few features thrown in. However, it has vastly accelerated my ability to start projects and develop high-quality, well-tested web applications.

AppFuse 究竟是什么? AppFuse 是一个你可以打包位一个 war 文件并可以在兼容 J2EE 1.3 的应用服务器中运行的 web 应用程序。它被设计成能够利用 build.xml new target 帮助你建立新的的 web 应用程序。 new target 允许你指定你的项目名称和数据库名称。一旦你建立了一个项目后,你可以利用 ant setup 创建 MySQL 数据库并发布程序到 Tomcat 。而且你可以执行 ant test-all 测试新工程的基本功能。这时,你可能会嘲笑说,“这有什么的,任何人都可以创建一个 .war 文件并发布到 tomcat”. 我同意这点,但是你有 setup-tomcat target 可以用来配置 Tomcat 的连接池的 JNDI 资源和 mail services ? 事实上, AppFuse 并不是什么突破性的发明,它只是由一个目录结构,一个 build 文件,一堆基类等组成,然而,它能够让我能够快速构建可以高质量开发,易于测试的 web 应用程序。

AppFuse tries to make it as simple as possible to build, test, and deploy your application. It virtually eliminates setup and configuration, which are often the hard parts. Tools like Ant, JUnit, XDoclet, Hibernate, and Spring can be difficult to get started with. Furthermore, features like authentication, password hints, "remember me," user registration, and user management are things that most web apps need. AppFuse ships with tutorials for developing DAOs, business delegates, Struts actions (or Spring controllers), integrating tiles and validation, and uses an Ant-based XDoclet task (written by Erik Hatcher) to generate master/detail JSPs from model objects. It uses slick open source tag libraries like Struts Menu (for navigation) and the Display Tag (for paging and sorting lists).

分享到:
评论

相关推荐

    AppFuse学习笔记(J2EE入门级框架)

    Appfuse是Matt Raible 开发的一个指导性的入门级J2EE框架,它对如何集成流行的Spring、Hibernate、iBatis、Struts、xDcolet、Junit、Taperstry、JSF等基础框架给出了示范。在持久层,AppFuse采用了Hibernate O/R映射...

    使用AppFuse快速构建J2EE应用

    本文以一个J2EE开发者的角度,借助一个简单的应用示例,在融合了个人经验的基础上介绍了如何用AppFuse一步步地构建J2EE项目。通过阅读本文,读者不仅能够学会用AppFuse进行开发,而且能够充分体会到AppFuse提供的...

    使用 AppFuse 快速构建 J2EE 应用

    NULL 博文链接:https://chixianhuadeyu.iteye.com/blog/368469

    AppFuse Architecture

    AppFuse:Directory Structure, Build/Test/Deploy Processes PPT格式

    appfuse开放web service指南

    appfuse开放web service指南 appfuse开放web service指南

    AppFuse

    本文以一个 J2EE 开发者的角度,借助一个简单的应用示例,在融合了个人经验的基础上介绍了如何用 AppFuse 一步步地构建 J2EE 项目。通过阅读本文,读者不仅能够学会用 AppFuse 进行开发,而且能够充分体会到 AppFuse...

    appfuse_quick_start

    AppFuse项目的主要目的是帮助你加速web应用程序的开发。

    可直接使用的appfuse项目

    AppFuse是一个集成了众多当前最流行开源框架与工具(包括Hibernate、ibatis、Struts、Spring、DBUnit、Maven、Log4J、Struts Menu、Xdoclet、SiteMesh、OSCache、JUnit、JSTL等(现在还有lucene的,无敌了))于一身的...

    appfuse

    使用appfuse2.0,下载过来的实例源码,没有jar包

    AppFuse1.x快速构建J2ee应用

    NULL 博文链接:https://danwind.iteye.com/blog/502826

    Appfuse教程Appfuse开发.pdf

    Appfuse是由Matt Raible开发的一个指导性的入门级J2EE框架,它对如何集成流行的Spring、Hibernate、iBatis、struts、Xdoclet、junit 等基础框架给出了示范。提供了对Taperstry和JSF的支持。  AppFuse是一个集成了...

    AppFuse入门文档(AppFuse与SpringMVC+mybatis整合)

    本文档详细描述了AppFuse与SpringMVC+mybatis整合的过程,只要你懂一些基本的eclipse操作和基本的maven命令,就可以在三分钟之内迅速的搭建出一个AppFuse的架构

    appfuse.tar.gz

    Developer notes on setting up your IDE to work with AppFuse are contained below. Instructions currently existing for Eclipse and IDEA. Netbeans is on the roadmap; you're more than welcome to create ...

    APPFUSE工具研究.doc

    Appfuse是一个开源的工程应用,它集成了现在最流行的开发框架到该应用中,使用Maven可以很方便的开发和部署因为。也可以集成到现在流行的开源开发工具如eclipse,idea等。现在让我们简单的看看APPFUSE开发应用的简单...

    appfuse1.4-architecture

    06年时的appfuse,学习SSH架构的经典入门框架。相对比较老的资料,可以欣赏一下当时的架构,向牛人致敬

    AppFuse项目研究

    Appfuse是由Matt Raible开发的一个指导性的入门级J2EE框架,它对如何集成流行的Spring、Hibernate、iBatis、struts、Xdoclet、junit 等基础框架给出了示范。提供了对Taperstry和JSF的支持

    ANT构建AppFuse

    AppFuse,j2EE起步,初学J2EE的学员们可以看看。

Global site tag (gtag.js) - Google Analytics