Current Java Web Framework Options

Listening to a podcast by Tim Shadel on difficulties with JSF and why he wouldn’t use it again brought up a current headache in the java web development space. Today’s options for java web frameworks blow.

Let me expound a bit:

Struts – Works fine, has been the defacto standard for years, but its showing its age. It hasn’t really been updated significantly in years. It doesn’t have an obvious successor yet since there is no Struts 2.0. It’s harder to test because it extends from all the framework classes. Within the java community it’s considered pretty much a legacy framework.

JSF – Very hyped and part of the J2EE spec so it’s supported by the app servers. Has a lot of vendor tooling support showing up. Has a very flexible event model. Is being pushed by the creator of Struts. Unfortunately it suffers from a host of problems. Tim Shadel described just a small part of this his recent post on JSF. Essentially he described how they had to get around JSF’s lack of handling GET requests with a few URL parameters.

His example was having one WAR file that needs to link to another WAR file and pass along an id. The hack involved:

  • Creating an extra JSP file.
  • Linking to the JSP file directly.
  • Send along the parameter.
  • Opens up FacesContext.
  • Gets the request object.
  • Pulls off the id parameter.
  • Locates a backing bean with session scope.
  • Stuffs the id the backing bean.
  • Forwards it to a JSF page.
  • Then it can pull up the appropriate page and get the parameter.

This is just plain ugly. Tim goes on to mention that when someone waxes grandly about JSF he asks a simple question? So how do you write a blog in it?

If this were JSF’s only problem it would be one thing, but testing the darn thing is really hard as well since it relies on things like FacesContext that have to be mapped. The only mock objects are found in the Shale project. Even something as simple as JWebUnit for testing from the front end fails because JSF relies on some javascript for just about everything.

I still have some hope that JSF may evolve to something reasonable, but today it’s still pretty messy.

Tapestry, Webworks, Wicket, Spring MVC, etc – I haven’t spent much time with any of these web frameworks for a simple reason. They don’t have really a large enough mindshare and community to make me think that betting the farm on them isn’t a huge risk. I have no doubt they are probably all better than Struts, but none of them have really caught on as a Struts successor.

This is exactly the reason why something like Ruby on Rails has so much appeal to java web developers since in Ruby it’s by far the defacto standard for web applications, and it includes lots of cutting edge features from built in unit test harnesses to AJAX support. Since JSF doesn’t appear to be the hoped for Struts replacement I wonder if we’ll see one anytime soon.

Technorati Tags:

, ,