Java的开源Web Framework简介

from :http://www.cjsdn.net/post/view?bid=20&id=127871&sty=3&age=0

Cocoon - 基于XML的Web内容发布
Cocoon是采用100%纯Java编写的一个内容发布框架。Cocoon让你能采用W3C的最新技术(DOM、XML、XSL)来提供Web内容。
新的Cocoon模式能将文档内容、样式、处理逻辑进行完全的分离,允许这三层能独立地设计、创建和管理,从而减少了管理开销,加强了工作的重用性,减少了开发时间。
下载地址:http://xml.apache.org/cocoon

Xang - 快速开发动态网页
Xang能整合不同的数据源,让你能快速地开发数据驱动的、跨平台的Web应用。Xang体系结构能将数据、逻辑和表示完全划清。Xang基于开放的工业标准,例如HTTP、XML、XSL、DOM、ECMAScript(JavaScrip)。
下载地址:http://xml.apache.org/xang

Slide - 内容管理框架
Slide是一个内容管理和集成系统,是一个内容管理底层框架。Slide提供了一个分级的结构,能将内容存储到任意的、分布式的数据仓库。出此之外,Slide还集成了安全、锁定、内容版本和其他一些服务。
下载地址:http://jakarta.apache.org/slide

Struts - 基于MVC设计模式的JSP
Struts是采用Java Servlet/JavaServer Pages技术,开发Web应用程序的开放源码的framework。
采用Struts能开发出基于MVC(Model-View-Controller)设计模式的应用构架。
Struts有如下的主要功能:
1. 包含一个controller servlet,能将用户的请求发送到相应的Action对象。
2. JSP自由tag库,并且在controller servlet中提供关联支持,帮助开发员创建交互式表单应用。
3. 提供了一系列实用对象:XML处理、通过Java reflection APIs自动处理JavaBeans属性、国际化的提示和消息。
下载地址:http://jakarta.apache.org/struts

Jetspeed - 基于Web的组件
Jetspeed 是实现了Enterprise Information Portal的开源软件。Jetspeed能从Internet的纵多资源中提取信息,来帮助用户管理大量的数据。这些信息能来自不同的内容类型,从 XML到XMTP,到iCalendar这些新协议。
下载地址:http://java.apache.org/jetspeed

Turbine - 基于Servlet的Web应用开发
Turbine是基于servlet的framework,使有经验的Java开发员能快速地构建web应用。
使用Turbine,可以通过创建使用特定服务来处理模板的Screen,来集成现有的模板技术(例如Velocity、Webmacro、Java Server Pages(JSP)、FreeMarker、Cocoon)。
下载地址:http://java.apache.org/turbine

各种Framework比较

在这些framework中,Cocoon、Struts和Turbine比较好。这三者各有所长,Cocoon是最好的XML Framework,Struts是最好的JSP Framework,Turbine是最好的Servlet Framework。

Matt Raible 写的Comparing Web Frameworks:
Matt Raible 是《Spring Live》一书的作者

Struts

. 优点
. The “Standard” - lots of Struts jobs
. Lots of information and examples
. HTML tag library is one of the best

. 缺点
. ActionForms - they’re a pain
. Can’t unit test - StrutsTestCase only does integration
. Mailing list volume is overwhelming

Spring MVC

. 优点:
. Lifecyle for overriding binding, validation, etc.
. Integrates with many view options seamlessly: JSP/JSTL,
Tiles, Velocity, FreeMarker, Excel, XSL, PDF
. Inversion of Control makes it easy to test

. 缺点:
. Not many using it
. Requires writing lots of code in JSPs
. Almost too flexible - no common parent Controller

WebWork

. 优点:
. Simple architecture - easy to extend
. Tag Library is easy to customize - backed by Velocity
. Interceptors are pretty slick

. 缺点:
. Documentation only recently written, few examples
. Client-side validation immature

Tapestry

. 优点:
. Very productive once you learn it
. Templates are HTML - great for designers
. Healthy and smart user community

. 缺点:
. Documentation very conceptual, rather than pragmatic
. Steep learning curve - very few examples
. Impossible to test - page classes are abstract

JSF

. 优点:
. J2EE Standard - lots of demand and jobs
. Fast and easy to develop with
. Rich Navigation framework

. 缺点:
. Tag soup for JSPs
. Immature technology - doesn’t come with everything
. No single source for implementation

Controllers and Views
. Struts: UserAction extends DispatchAction
. Spring MVC: UserFormController extends
SimpleFormController
. WebWork: UserAction extends ActionSupport
. Tapestry: UserForm extends BasePage
. JSF: UserForm

List Screens
. How easy is it to integrate a sortable/
pageable list of data?
. Struts, Spring MVC and WebWork can all
use Tag Libraries like the Display Tag
. Tapestry has a contrib:Table component
. JSF has a dataTable with no sorting - have
to write your own logic if you want it

Bookmarking and URLs
. Using container-managed authentication (or other filterbased
security systems) allow users to bookmark pages.
They can click the bookmark, login and go directly to the
page.
. WebWork has namespaces - makes it easy
. Struts and Spring allow full URL control
. Tapestry has ugly URLs - difficult to segment the app for
different roles
. JSF does a POST for everything

Validation
. Validation should be easy to configure, be robust on the
client side and either provide good out of the box messages
or allow you to easily customize them.
. Struts and Spring MVC use Commons Validator - a
mature solution
. WebWork uses OGNL for powerful expressions -
client-side support very new
. Tapestry has very robust validation - good messages
without need to customize
. JSF - ugly default messages, but easiest to configure

Testability
. Struts - can use StrutsTestCase
. Spring and WebWork allow easy testing with
mocks (i.e. EasyMock, jMock, Spring Mocks)
. Tapestry is impossible to test because page classes
are abstract
. JSF page classes can be easily tested and actually
look a lot like WebWork actions

Success Messages
. The duplicate-post problem, what is it?
. Easiest way to solve: redirect after POST
. Struts is the only framework that allows success
messages to live through a redirect
. Spring and WebWork require custom solutions
. Tapestry requires you to throw an Exception to redirect
. JSF requires a custom solution, i18n messages difficult to
get in page beans

Spring Integration
. All frameworks have integration with Spring
. Struts: ContextLoaderPlugin and Base classes
. WebWork: SpringObjectFactory
. Tapestry: override base engine, grab from servlet
context, put into global map
. JSF: DelegateVariableResolver or JSF-Spring Library

Internationalization
. JSTL’s tag makes it easy
. No standard for getting i18n messages in
controller classes
. Struts, Spring and JSF encourage one
ResourceBundle per locale
. WebWork and Tapestry advocate separate
files for each page/action

Page Decoration
. Used Tiles since it first came out in 2001
. SiteMesh is much easier to setup and use
. Tiles can be used in Struts, Spring and JSF
. Requires configuration for each page
. SiteMesh can be used with all frameworks
. Requires very little maintenance after
setup

Tools
. Struts has a lot of IDE support and even has
frameworks built on top of it (i.e. Beehive’s
PageFlow)
. Spring has Spring IDE - only does XML validation,
not a UI/web tool
. WebWork has none
. Tapestry has Spindle - great for coders
. JSF has many, all cost money and hook into
proprietary app servers

Business/Marketing
. Struts is still in high-demand and widely-used
. Spring is getting more press, but mostly due to the
framework’s other features
. WebWork is gaining ground, but pretty scarce on
job boards
. Tapestry is even more scarce - needs more
marketing
. JSF is quickly becoming popular

My Opinion //Matt Raible 建议
. Struts is fast to develop with because most problems have
been solved. HTML tag library the best of the bunch.
. Spring is nice, but lack of form tags drops it down a notch
or two. JSP 2.0 tag files exist in issue tracker.
. I like WebWork a lot, but lack of of good client-side
validation support is a killer.
. Tapestry - I haven’t finished the learning curve.
. JSF - needs to listen to developers to see what they want
instead of tools vendors.

Which would I choose?
. Quick and dirty project?
. Struts because I know it best
. Massive enterprise project?
. Tapestry for its reusable components
. If I got a job as an open source developer?
. WebWork because using it requires you to dig into the frameworks

Resources //资源
. Download sample apps for this presentation
. http://equinox.dev.java.net/framework-comparison
. Struts - http://struts.apache.org
. StrutsTestCase: http://strutstestcase.sf.net
. Spring MVC - http://www.springframework.org
. Spring IDE: http://www.springframework.org/spring-ide/eclipse
. WebWork - http://opensymphony.org/webwork
. Eclipse Plugin: http://sf.net/projects/eclipsework
. IDEA Plugin: http://wiki.opensymphony.com/display/WW/IDEA+Plugin
. Tapestry - http://jakarta.apache.org/tapestry
. Spindle: http://spindle.sourceforge.net
. JSF - http://java.sun.com/j2ee/javaserverfaces and http:// myfaces.org
. Java Studio Creator: http://sun.com/software/products/jscreator
. MyEclipse: http://myeclipseide.com
. IDEA: http://www.jetbrains.com/idea
. SiteMesh: http://opensymphony.com/sitemesh
. Testing Frameworks
. JUnit: http://junit.org
. EasyMock: http://easymock.org
. jMock: http://jmock.org
. jWebUnit: http://jwebunit.sourceforge.net
. Canoo WebTest: http://webtest.canoo.com
. XDoclet - http://xdoclet.sourceforge.net
. AppFuse - http://appfuse.dev.java.net //强烈推荐学习这个东西,集成了很多的开源技术

Books //参考书籍
. Struts in Action, Ted Husted and Team
. Struts Live, Rick Hightower and Jonathan Lehr
. Spring Live, Matt Raible
. Spring in Action, Craig Walls and Ryan Breidenbach
. Professional Java Development with Spring, Rod
Johnson, Juergen Hoeller and Team
. WebWork in Action, Patrick Lightbody and Team
. Tapestry in Action, Howard Lewis Ship
. Core JSF, David Geary and Cay Horstmann
. JSF in Action, Kito Mann

The End //结束
...or is it just the beginning...

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值