Over a million developers have joined DZone.
Platinum Partner

MyFaces Aligns With the JSF 2.0 Standard

· Java Zone

The Java Zone is brought to you in partnership with JetBrains.  Learn more about Kotlin, a new programming language designed by JetBrains to solve problems that software developers face every day.

The Apache MyFaces 2.0 Final was just released with support for Java Server Faces 2.0 (JSR 314).  This release comes hot on the heels of RichFaces 3.3.3, which also implements a partial version of JSF 2.0 while offering backward compatibility with JSF 1.2.  MyFaces has several useful new features including a system variable that is comparable to rails_env in RoR.  

The JSF 2.0 features are the most important in MyFaces 2.0.  The JSR 314 standard, which was approved in July 2009, enables Facelets as the new view handling technology.  JSF 2.0 also includes built-in Ajax integration, which features a JavaScript library.  To execute a JSF component, you just need to use a JavaScript function (jsf.ajax.request()) or an Ajax request (<f:ajax>).  Only the relevant request components are processed.

JSF 2.0 Event Model

Developers can also harness composite components, which generate a complete JSF component using a Facelet.  This feature makes component creation much easier than in past JSF implementations.  It's also easier to integrate view declaration languages (VDLs) in MyFaces 2.0.

The new project stage variable (comparable to rails_env) is another productivity feature that uses values like Development, Production, UnitTest, and System Test to tell the framework the current stage of the project.  For each of these values, developers will be able to access information that is relevant to that stage.  You can also save URL's as bookmarks in MyFaces 2.0.  In addition, request parameters can be handled much like entry components and you can work exclusively with GET requests via <h:link> and <h:button>.

MyFaces 2.0 adds support for a variety of standard APIs including error handling, loading resources, bean validation, and system events.  Developers will also find that there's less XML config work to be done.  Annotations such as @ManagedBean and @SessionScoped are now supported in MyFaces 2.0.  Finally, the release rounds out with improved component status storage, view and flash scopes, and expanded navigation features.

The full change list can be found here.

The Java Zone is brought to you in partnership with JetBrains.  Discover how powerful static code analysis and ergonomic design make development not only productive but also an enjoyable experience.


{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}