Are There Any JSF Best Practices

I attended a talk today at SD West 2006 really hoping to hear some hard earned lessons on better approaches to JSF development. Heck, the talk was entitled:

JavaServer Faces Programming and Best Practices

Unfortunately I got a high level overview of JSF and how great it is will be with JSF 1.2. The whole spiel about the 6 phase event life-cycle and how great it is that you have another XML configuration file and another tag library. It turns out the best practices are part of Sun’s blueprints.

The JSF blueprint stuff is almost laughable. They actually use this statement on how to do templating in JSF:

As we saw, a developer can simply create a layout with

1
<h:panelGrid*>

then copy and paste the same template to each page. This is a quick and easy way to develop web pages.

Creating a Common Look and Feel Using Templating

Great example of code reuse that cut and paste pattern. Isn’t that in the Gang of 4 Book as a classic pattern?

From what we heard the solution to most of our problems with JSF was to use Java Creator Studio 2. We got a quick demo of it. Nice clickity, click interface, you drag and drop a GUI widget and then link it directly to a database table, and you’ve got Enterprise Architecture.

As it turns out the most valuable part of the talk was gathering anecdotal evidence. Despite this being the only talk about JSF at the whole conference with 280+ sessions there were only about 30 people there. When she asked how many of us were using JSF only about 10 of us raised our hands. When she asked if people were using Struts virtually the entire room raised their hands.

The JSF story is still frustratingly incomplete.