向你推荐---AppFuse(E文章转载)

Application-mobile:单代码源-Mobile app source code 移动应用 单代码源 立即下载
AppFuse: Start Your J2EE Web Appsby Matt Raible
07/15/2004


Contents
The Birth of AppFuse
What Is AppFuse?
What Does the Future Hold?
AppFuse Light
How Do I Start Using It?
Resources

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.

The Birth of 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.

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.

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.

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.

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.

What is 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 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).

One of the best parts, in my opinion, is that it embraces the Java community's ideas and suggestions. The directory structure and build file are largely based on Erik Hatcher and Steve Loughran's excellent Java Development with Ant book. In this book, Erik built a sample application that inspired me to learn more about Ant and XDoclet -- and use it in my Struts development.

When I first started learning and using Hibernate in AppFuse, I made many mistakes -- and the community let me know. At first, I opened and closed its Session object for each DAO method. When Gavin told me this was a bad idea, I made modifications to use an OpenSessionInView pattern, with my own ServletFilter to do the work. I passed the session object into each method signature, for which the community repeatedly questioned my logic. My answer was, "I wanted to get it working more than anything -- do you have a better idea?" The better idea turned out to be using the Session as a constructor argument, which worked pretty well.

Then, late last year, I discovered the Spring framework and found the beautiful solution I'd been looking for. Using its ORM support, I was able to eliminate any Session handling in AppFuse; now Spring elegantly handles it all. AppFuse now uses Spring's OpenSessionInViewFilter. All I needed to do was configure it in web.xml and it manages opening and closing the session for me. When I integrated Spring in AppFuse's persistence layer, I deleted two or three classes and reduced my LOC count by around 75 percent. All of the Hibernate issues I'd had before disappeared! In addition, I was quickly able to add a DAO implementation using iBATIS, which I worked with on a project last year. On that project, I discovered that iBATIS was easy to use and worked very well for interacting with complex database schemas.

AppFuse is not only a jumpstart kit for your web apps; it's also a showcase for integrating technologies like Hibernate, Spring, and Struts. Tutorials exist for integrating these different open source components, but rarely do they give you an application you can walk away with and use to develop your next application. In a sense, AppFuse is a glue that binds open source projects together. When I found Spring, it was a perfect fit, since it was the glue to configure components and loosely couple the different layers of an application. Erik's book might have been the match that lit AppFuse, but Spring is the gasoline that really got it roaring. Spring has vastly simplified how I develop with AppFuse and forced me to follow best practices in J2EE. In short, it's the best tool I've ever used with J2EE. I realize Spring is not the be-all-end-all for J2EE applications -- AppFuse worked fine before I integrated it. However, it helped answer all of my "How should I do ..." questions -- which was a nice relief.

What Does the Future Hold?

AppFuse 1.5 was released at the end of May. Its major feature is the option to use Spring MVC instead of Struts. All of the tutorials have been updated to educate users how to use Spring (or Struts) for their web layers. For AppFuse 1.6, I plan to add support for using WebWork and SiteMesh, as well as make it easier to run unit tests from Eclipse and IDEA. By the end of the year, I hope to add Tapestry and JSF as MVC options. The middle tier and back end (Spring plus Hibernate) probably won't change much. It's a well-oiled machine at this point. This isn't to say that I think AppFuse is perfect. I hope I continue to receive valuable feedback and suggestions. After all, this is the driving force behind improving its quality.

When I find innovative and easier ways to develop web apps, it ends up in AppFuse. People ask me why AppFuse doesn't support Middlegen. The reason is simple: I've never used or needed Middlegen on a project, so I don't see any reason to add it. If I end up on a project where I use Middlegen, you can bet I'll end up adding support for it. Recently, I started using Spring's MVC framework instead of Struts. At first, I found it a bit difficult to understand, so I implemented the web layer with Spring MVC. Since the web layer contains many features that I use in web apps (i.e., templating, validation, file upload, and exception handling), I learned the ins and outs of Spring MVC by integrating it.

Using and learning AppFuse is a good way to keep up to date with the latest releases of its dependent projects. I try to keep as up to date as possible with new releases -- and due to AppFuse's unit test coverage, I can easily test new releases by dropping them in and running ant test-all. This even works for dependent resources such as Tomcat and MySQL, in which I've found bugs via AppFuse. For me, it acts as a testing tool to verify the functionality of new open source releases.

AppFuse Light

Equinox is a lightweight version of AppFuse; hence its pseudonym "AppFuse Light." I was inspired to create it when looking at the struts-blank and webapp-minimal applications that ship with Struts and Spring, respectively. These "starter" apps were not robust enough for me, and I wanted something like AppFuse, only simpler -- with no build-time dependencies.

It's designed to show web app developers how to start a bare-bones Struts/Spring/Hibernate app using the QuickStart Chapter in Spring Live. More functionality may be added in the future, but the main goal is to provide a better implementation of a bare-bones web app.

Equinox should mostly be used for writing tutorials and rapid prototyping. I don't recommend using it for starting a full-fledged production application. That's what AppFuse is for.

How Do I Start Using It?

The best way to get started using AppFuse is to download it and read the QuickStart Guide. AppFuse is a part of the Java Enterprise Community on java.net. Its project homepage is at appfuse.dev.java.net.

If you're interested in Equinox, you can read the QuickStart Chapter from Spring Live to build a quick and easy application using Struts, Spring, and Hibernate. If you like, you can view a demo of the MyUsers application that this chapter helps you build. Equinox is a sub-project of AppFuse on java.net. Its project homepage is at equinox.dev.java.net.

Resources

Matt Raible is currently authoring Spring Live and is a member of the J2EE 1.5 Expert Group. He blogs about J2EE and his experiences on both jroller.com and raibledesigns.com.

ABP框架实战:从零搭建多租户应用(含完整代码示例) 本文详细介绍了如何使用ABP框架从零构建多租户SaaS应用,涵盖多租户架构设计、数据隔离实现、租户管理及性能优化等核心内容。通过完整的代码示例,帮助开发者快速掌握企业级数据隔离系统的开发技巧,提升SaaS应用开发效率。 阅读详情

相关推荐

dmx512协议c语言编程,DMX512协议+c程序代码.pdf

DMX512 协议1.协议简介DMX 是Digital MultipleX 的缩写 ,意为多路数字传输。DMX512 控制协议是美国舞台灯光协会(USITT)于1990 年发布的灯光控制器与灯具设备进行数据传输的工业标准 ,全称是 USITT DMX512(1990) ,包括电气特性、数据协议、数据格式等方面的内容。2. 电气特性和物理层2.1. 电气特...

weixin_39928993的博客 2556

Android数据存储与IO之二(File存储之openFile)

Android数据存储与IO之二(File存储之openFile)     介绍了Android提供的SharePreferences接口及其提供的方法后,我们发现,SharePreferences仅仅适用于存储一些简单的基本数据类型比如说配置信息等等,且其存储格式单一为XML,存储信息的单一类型以及存储格式的单一局限了其使用的范围。所以Android提供了另外一种数据存储及IO方式----

u013573135的专栏 802

SAP-ABAP:SAP中如何查看系统表之间的关联关系?

在业务逻辑开发或者ALV开发过程中,我们通常要从系统中找出几个标准表之间的关联关系,有的是head与item,通过外键进行关联的关系。那么怎么去找到呢?以上就是具体如何产看系统表之间的关联关系的步骤,对于不同代码的业务顾问,也是必须要掌握的。

LinkStar的博客 2433

appfuse的好处与问题

Appfuse的实际益处:l       减少代码的书写——hibernate的map文件,值对象和formbean不用重复书写。但是难点是编写新的不熟悉的牌子文件(解决方法,将ant工具配置起来)l       Appfuse的力量在整合。使用各种流行的技术整合成为现成的解决方案,而且这个方案是面向开发的,实际上是一个开发工程。Appfuse的问题:l       但是这里有一个

我是谁 1463

海康威视摄像头网线连接笔记本电脑,客户端提示:1连接设备失败。设备不在线或网络原因引起的连接超时等。(HCNetSDK.dll[7].)解决方案

1.环境 电脑:联想笔记本电脑(win10系统) 摄像头:海康威视DS-2CD3T20D-i5,4mm 连接方式:直接用网线将摄像头和摄像头连接 2.问题: 客户端出现如下提示: 3. 解决流程: 1.确认网线是否有问题:我的网线指示灯常亮,并且设备能够被搜索到,只是一直显示离线 2.按照网上教程直接配置摄像头的ip地址与电脑同一网段:登录失败。 错误码为 HCNetSDK.dll[7].(连接设备失败。设备不在【海康威视吧】_百度贴吧 失败了,没有反应 3.查看有线网卡的地

weixin_48911487的博客 3万+

ZXDoc工业级CAN总线仿真工具全解析与应用实践

CAN总线作为现代工业通信的核心协议,其仿真技术是汽车电子和工业控制领域的关键支撑。通过物理层信号模拟、协议层报文解析和应用层人机交互的三维仿真,开发者能够构建完整的硬件在环测试环境。ZXDoc作为工业级仿真工具,集成了DBC工程化管理、HMI面板设计和自动化测试脚本等核心功能,特别适用于ECU开发、产线验证等场景。工具支持ISO11898标准协议,提供错误帧注入、负载压力测试等高级特性,结合Python API可实现复杂测试用例的自动化执行。在新能源车VCU测试等实践中,通过优化采样点等参数配置,显著提升

weixin_30096975的博客 483

appfuse1.9x displaytag中文乱码

ant new了一个新工程,部署上去后displaytab出现乱码,解决步骤: appfuse ant new出来之后的displaytag_zh_CN.properties文件里面中文乱码,从源代码中将该文件替换; 修改build.xml ,具体看修改后第7、15行。 修改前: <!-- Copy any resource or configuration files --...

亿度思考 173

4、风险管理、信息安全与信息管理的核心原则

本文深入探讨了风险管理、信息安全与信息管理的核心原则,涵盖Risk IT框架、ISO 31000标准以及信息安全与信息管理的关键原则。通过案例分析与实际应用挑战的解析,帮助组织更好地应对数字化时代的风险与安全问题,实现可持续发展。

bread的博客 126

Gathering Initial Troubleshooting Information for Analysis of ORA-4031 Errors on the Shared Pool

In this Document Purpose Troubleshooting Steps References APPLIES TO: Oracle Database - Enterprise Edition - Version 8.0.6.3 and later In...

weixin_30549175的博客 168

「JS逆向三百例」JS逆向HIKVISION-视频监控的前端密码加密

本文详细分析了HIKVISION-海康威视监控前端登录过程中密码的加密机制,通过逆向工程解析了其 JavaScript 加密逻辑,重点研究了HIKVISION-海康威视监控的前端密码SHA256加密算法的实现。基于逆向分析结果,使用 Python 模拟了HIKVISION-海康威视监控的登录流程,最终实现了自动化登录功能。本文旨在为安全研究人员提供技术参考,帮助理解前端加密机制,并强调技术研究的合法性和合规性。

布啦啦 1106

Allegro层叠中的Etch Factor-铜皮的腐蚀因子如何计算

在用Allegro进行PCB设计的时候,Cross-section中需要填入对应的信息,一般填入每层的厚度即可,如下图。当PCB需要进行仿真分析的时候,Etch-Factor这个值是必须要填写的,如下图。实际铜皮进行蚀刻的时候,Etch-Factor的值并不是标准的90度,如下图。线路层实际形状是个梯形,Etch-Factor代表的就是梯形的角度,如下图。首先输入数值,比如1,再点击Inv,最后点击tan-1,可以得到角度的值。如果tanσ=2,σ=63.4,如下图计算结果。即tanσ=1,得到σ=45。

weixin_54787054的博客 889

Accessing Java Constants from JSTL or OGNL

Accessing Java Constants from JSTLEven there could be many variations to the above code, more creative, funnyer or...

cmqn6968的博客 213

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

laravel 表单验证 正则验证 不包含中文

$rules = [ 'comid' => 'required|exists:company_base,comid', 'classcode' => [ 'required_unless:classtype,CX', 'regex:/^[A-Za-z\d-.]+$/', Rule::unique('class_riskl...

上官hao的博客 2313

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

appfuse

http://raibledesigns.com/wiki/Wiki.jsp?page=AppFuse_zh 

384

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

Effective Java 第三版读后感第二条:多个构造器参数时考虑构建器(建造者设计模式)

在上一篇中介绍了构造器创建对象和使用静态工厂创建对象的相关内容,如果你想了解更多可以访问这篇文章 :第一条 使用静态工厂方法代替构造器 重叠构造器的弊端 静态工厂和构造器它们都有个共同的局限性:多个构造器可选参数的问题,当一个类有很多个成员变量,有些参数是必须的,有些参数是可选的,这样的构造器方法将会有多个。通常这种情况下,程序员一般会考虑到重叠构造器(telescoping constructo...

GalenGao 493

实现将一个工资汇总表sheet拆分成多个个人工资单sheet

公司全部人员月工资以一sheet报表(如下图:表第一行为姓名,工号等等下面一行一行为各人员的本月工资)保存,欲实现以下功能:问题点:如何把每个人的工资单记录单独取出生成以独立的SHEET,即假设有10个员工就生成10个sheet  Private Sub CommandButton1_Click()For i = 2 To [a1].End(xlDown).Row    Sheets.

oceayan的专栏 7037

今天的收获---实现excel工资单的自动发送

每个公司每月发工资的同时要给每个员工一张工资单。而发工资单的主要目的是让员工知道自己一个月来工资组成的详细情况,确认财务结算是否有误。一般的处理方式是直接在原来全员工资表的基础上给每个员工记录前插入表头等整张打印出来后一条一条的剪裁出来发给各个员工。这种方式对小公司来说还可以,但当公司达到好几十上百或上千的员工时,财务人员光每个月剪裁着工资单就要花不少时间,而且还要花费很多纸张我们的解决方式是

oceayan的专栏 3366

Java读文件

import java.io.DataInputStream;import java.io.FileInputStream;public class test{ public static void main(String args[]){         java.lang.String fileName = "C://test.csv";   java.io.File objFile = ne

oceayan的专栏 2066

用Java生成文本文件(收集)

import java.io.File;import java.io.FileWriter;import java.io.PrintWriter;import java.io.IOException;public class Result {  private File result =new File("result.txt");  private FileWriter writer;  pri

oceayan的专栏 1477

struts多国语言支持

Java本身就支持多国语言编码,不需要写任何程序,可以很简单的 实现。 秘诀就是两点: 1、所有HTML/JSP页面全部采用UTF-8编码 2、客户端浏览器完全支持UTF-8编码 步骤: 1、首先把所有的HTML/JSP的ContentType都设为UTF-8 2、然后对于JSP程序中的非ASCII码提示信息都不应该写在程序里面,都应该放在 application.properties里面统一管理

oceayan的专栏 1410

JavaScript在页面间数据传输的使用

功能描述:从主页面把tantousyaID,edaban,torihikisakiTantousyamei三个字段传到参照子画面。参照子画面以这三个关键字为检索条件检索出符合条件的记录当把光标定在某条记录上后点击确定后即把选定的那条记录的值回传填充到主画面相应项//************************************************************// 主画面把

oceayan的专栏 1385

JAVA中判断某详细信息列表中是否有空项(经验总结)

   /**     * 明細抜けフラグの設定 .     *      * @param lineVoList     *            明細VOオブジェクトリスト     */    private void setDetailNukeFlg(List lineVoList) {        logger.info("-------setDetailNukeFlg:START----

oceayan的专栏 1354

STRUTS中光标定位问题

某个页面的内容中有头和详细内容两部分:头部主要是些查询条件以及从前页面传来的字段;详细内容部显示根据条件查询出的一系列记录---另外,每条记录有一些字段是可以在本页进行编辑和添加的。一般的这样的页面也会带有检查编辑或添加的内容是否符合某种条件,当我们编辑了某字段后点击“检查”功能,通常检查后光标都是定位在详细内容部份的第一条记录的某个字段或页面头部。但这样如果详细内容中记录非常多时我们检查后检查通

oceayan的专栏 1075

Jsp小结1,2点

1.Jsp页面输入内容显示时tag文字和换行处理从输入页面的文本输入框输入两行文字:huuhhあいうえお?确认后转入下一确认页面时,发现换行信息已被自动去除,另外,tag文字被以处理html的方式处理,没有正确显示输入信息。解决方案在确认页面对所要显示的信息做如下处理上面的问题就迎刃而解了:假设要显示的信息保存在一个字符串变量comment中,在显示之前对它做如下处

oceayan的专栏 1053
上一篇: 关于对日软件开发
下一篇: 我该怎么办---一个软件设计师的思考
oceayan
博客等级 码龄25年 3粉丝 33原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值