Posted by jhook
on March 29, 2006 at 10:45 PM PST
Facelets recently revised its compiler to create a view layer that works with JavaServer Faces in it's most true form. It's the most practical way of delivering rich, component-based web applications with the ease of Model 1 development.
After a lot of community testing with the 1.1 releases, we've decided to create a stable, milestone release available here . Facelets already has great documentation and provides unbeatable error handling with debugging features for the JavaServer Faces framework.
True Component Development
Many component frameworks available today still fall within the same development requirements as Model 2 frameworks, such as Struts. You have to create a document that represents your view and produce a secondary action or page object of pure adaptor logic/code. With JavaServer Faces, you just have your single document, and the work required of other component frameworks is done automatically by weaving the view and controller aspects together when needed.
Facelets goes one step further as a view technology as it caters specifically to the mechanics of JavaServer Faces. Starting with the compiler, all content, such as text and non-components, is interwoven in such a way that the expensive character data is shared for all users/threads. This helps to keep the pricey aspects of buffering/appending character data within the view to a minimum while avoiding wasteful evaluation.
This really comes to light when you start to look at what's around the corner for MVC with AJAX and partial processing. Views can be constructed without evaluating unecessary results unless required-- setting the stage for things like avatar . No specialized actions, no breaking up of documents, this is purposeful and practical applications of AJAX without lock-in or commitment in your development strategy. Developers complain enough as is about the complexities of MVC on the web, now they think writing specialized logic for AJAX will make their lives easier? Come on, lets approach this sensibly with component-based frameworks.
Finally, Facelets really pushes convention over configuration in the presentation, removing the need to write adaptor code even within the presentation for
Converters. Although, custom tag development is a piece of cake .
So What's Different in 1.1?
Adam Winer contributed a weekend to modifying the way that shared content, such as non-components, were handled with Facelets' compiler. Now Facelets works directly with the
ResponseWriter to produce all the appropriate events for writing elements, comments, attributes, text, etc. The result of this is two fold: we've now cleared up browser specific issues (eg. tags) and JSF developers are now able to customize the their
ResponseWriter implementation to further enhance the output of the whole view for specific platforms, markups, or client/server communication (such as DOM or Fast Infoset).
Along with other bug fixes, the templating features now have better support for inheritance of views and a
<ui:repeat/> component was added for times when you need to iterate over collections of data. This component, in conjunction with Facelets' common aliasing features, allows you to inline the repeating right on your
<li/> tags in HTML.
As always, open source projects are a work in progress. While much of the core of Facelets has stablized in functionality, I'd like to start vesting time in purposeful component development and web standards with JavaServer Faces. I'm also getting more eager to produce examples of XUL and XAML (windows vista) with JavaServer Faces and Facelets. Lastly, Facelets EL implementation is configurable, so I'd like to see OGNL or JEXL implementation of the the standard EL-API available soon ;-)