Thursday, October 08, 2009

What new in JSF 2?

What new in JSF 2?
The follow link gives out a lot of info. Andy Schwartz has created a fantastic introduction to the new features of JavaServer Faces 2.

The follow is a slide of introduction of JSF.

JSF 1.x Part of Java EE Standard (JSR 127, 252)
Component oriented web framework
Two implementations: Sun, Apache
Veeeery extensible
Tool support
Third party component libraries

JSF 2.0Part of Java EE 6 (JSR 314)
Reduced XML configuration
Better error handling
Support for GET requests
Easier component authoring
Resource handling
Lots of plumbing for tool builders

Easy NavigationBefore:

Managed Bean Annotations

FaceletsWas third party extension (Jacob Hookom)
Now part of the standard
The preferred view handler in JSF
No more JSP mess
MUCH better error messages
Page composition

Bookmarkable URLsIn JSF 1.x, everything is a POST
Browser bar URL one step behind
Can't be bookmarked
JSF 2.x supports GET requests
New tags h:button, h:link
View Parameters
.Bound to beans when request comes in
.Can be attached to next request

Composite ComponentsMade up of simpler components
Example: Login component with username/password fields
True JSF components
Can attach validators, listeners
Specified with XHTML+composite tags


Minor Features
Resource loading
Standard resources directory
h:graphicImage, h:outputStylesheet, h:outputScript have library, name attributes
<h:outputStylesheet library="css" name="styles.css" />
Dynamic versioning
Botched attempt at i18n
New scopes
View scope
14 new events
Most useful for app developers: preRenderView, postValidate
<f:event type="postValidate" listener="#{user.validate}"/>

How to PlayRI is feature-complete but not bug-free
Download JSF 2.0 RI from
Works with Tomcat
Or download Glassfish v3 Prelude
Or Netbeans 6.7 RC
Caveat: These may not have the latest JSF 2.0 implementations today

Looking ForwardComponent libraries for 2.0
Cruft removal
Integration with Web Beans (JSR 299)

No comments: