How many Frameworks does it take to change a light bulb…..

Variety is definitely one word that comes to mind when thinking about Java based Web Frameworks, since the ‘pre-historic’ days of Struts there has been an explosion in the number of frameworks available.

One of the earliest successors to Struts was JSF. JSF has not had an easy time, for starters there were many issues with the JSP integration and due to the way that the JSF life-cycle worked, templating tools such as Tiles and Sitemesh were incompatible. However JSF came through the  problems and has developed into one of the most mature and complete Web frameworks available, plus with a 2.0 release in the works things are looking pretty good.

Having used JSF in anger on a number of different projects I felt I should write a post discussing some of the things I really liked about the framework  and also some of the areas where it is in need of improvement.

Benefits of JSF

JSF is a standard, it has the backing of the specification JSR – 127.  Vendors such as Oracle, and IBM have got a lot of incentive to support it. This has lead to the availability of a large number of high quality third party components. It is also worth noting that I have observed considerable JSF adoption in larger companies in particular, despite the overwhelming number of high quality alternatives.

JSF is view independent, therefore you are not tied to just using JSP’s as your view technology. I believe this has been a tremendous benefit as a newer templating language in the form of Facelets is available, which has made development in JSF much easier.

You can access beans directly by their names as opposed to another more convoluted mechanism.

JSF adopts the POJO model, whereby your bean doesn’t need to extend any other class, as is the case with Struts. This leads to cleaner more decoupled code.

Validation is very easy to do in JSF. One of my favourite aspects is the generic validation that it offers. For example if you have an age field you can do the following:

<h:inputText id="age" value="#{UserRegistration.user.age}">
 <f:validateLongRange maximum="150" minimum="0"/>
</h:inputText>

There is a large and active community and numerous components available. RichFaces and Icefaces are particularly notable but there are many others. There is lots of useful reference material available, and many active forums on the subject, most notably the Sun and Javaranch forum.

There are multiple implementations of JSF which means that you are not tied to one implementation.

The Problem with JSF

Having said all of the positive things above there are still many ways in which JSF could be improved:

There is still more XML configuration than I would like, especially when you compare it to some of the newer frameworks such as Wicket and Struts 2.

No support for bookmarking URLs

Creating new components is way too complicated.

Navigation rules are defined in an XML file, which can grow and become fairly complicated and brittle as the application becomes more complex.

So where does that leave us

In conclusion I would say that JSF has come a long way since the release of the first version, and thanks to complimentary tools such as Facelets, and RichFaces it has become a lot easier to use and has gained traction with developers.

As I mentioned earlier, there is a new version of JSF, code named Mojarra, which has a lot of promise. I am currently experimenting with a reference implementation of Mojarra, and will report back on my findings so stay tuned!

VN:F [1.1.5_471]
Rating: 7.5/10 (2 votes cast)
Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Mixx
  • Slashdot
  • StumbleUpon
  • TwitThis

Related posts:

  1. My Top Java Technologies One of the best things about working in Java development...