Coming Up for Air

JSFTemplating Meets Facelets

I could be wrong, but I think it’s safe to say that most people don’t know about JSFTemplating, which is a pity, as it’s a pretty nice alternate ViewHandler implementation from Ken Paulsen, GlassFish admin console architect. One of the coolest features, I think, is its introduction of templating events (e.g., one can attach a beforeEncode event to a component on a page and have a handler method fire before that component is encoded). The first comment I hear, though, is usually something about template syntax, and it does seem a bit foreign with things like <!if $attribute{in} & ! (#{in} = abc) > and <span class="code">#include /header.inc</span>. That’s where I come in.

Ken and I got to talking about the project, and, given my experience with Facelets and my involvement with the JSF RI (not to mention my apparent inability to say no :), he asked me if I would be interested in writing a Facelets-compatible format for JSFTemplating, which is another really cool feature of the library: the "formats" are pluggable. That is to say, when you write a web page in a given format, the format handler (technically, a LayoutDefinitionManager) translates the page into a LayoutElement tree, which the core of JSFTemplating then processes to create the UIComponent tree that JSF needs to see. The technical challenge intrigued me, so I agreed to take it on, giving me another lunch time project. :P

The short-term goals of the effort are to create a format that is functionally equivalent to the templating in Facelets. That is to say, we intend to duplicate the functionality of the ui:* "components" in Facelets, while adding support for the event model that JSFTemplating provides. Once that’s done, I’d like to take a look at some of the more advanced features exposed via the taglib.xml, but we’re taking Dr. Leo Marvin’s advice and taking baby steps. :)

For those interested in tracking the progress, the source code is available in the JSFTemplating CVS tree, which you’ll be able to see once java.net finishes its massive upgrades. ;)

Quotes

Sample quote

Quote source