Monday, March 30, 2009

JSF and AJAX - Still no Good

AJAX is the way of life for web developers. If you are a Java Enterprise developer, more specifically a JSF developer, you will find loads of AJAX/JSF libraries. But if you decide to use one of them, you will not be able to use components from any of the other libraries (in most cases). In other words your application will be locked into the library you choose to use.

I found a good article today on JDJ "JavaServer Faces: The Importance of Components" by Jim Cook. The following paragraph was interesting:

AJAX fits in with the JSF framework very naturally. However, the early JSF specifications (1.0, 1.1, and 1.2) don't address AJAX. One of the consequences is that each vendor of JSF components has built its own AJAX engine and the various engines aren't always compatible. Although this issue is being addressed in the upcoming 2.0 specification, for the time being, component users are basically forced to choose components from only one vendor if they want to use AJAX.

According to this, until the 2.0 JSF specification has been implemented by all the major JSF libraries, its probably better to stay away from them if you want to prevent a lock-in. Look at it this way. If you do use one these AJAX/JSF libraries today, tomorrow when they come up with the new JSF 2.0 compatible version of their library, your application will not be able to use it.

So what can Java developers who need AJAX do today?

You can use a pure Javascript based AJAX library like Dojo or YUI along with Spring and Hibernate. At least you know that tomorrow when Dojo and YUI come out with their new versions, your application can make use of them. Yes, your application will be locked into YUI or Dojo. Life is not perfect.