Coming Up for Air

JSFTemplating Meets Facelets

Wednesday, Apr 4, 2007 |

JSFTemplating Meets Facelets

Jason Lee 2007-04-04

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">&#35;include /header.inc</span>. That's where I come in. // more

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 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. ;)