Tuesday, November 23, 2004

Current Opinion of JSF - A Face with no features?

Java Server Faces has a lot going for it. However, it also has a lot of catching up to do!

JSF has been on Sun’s public agenda since 2001. A lot of lofty goals were set to produce a better Web Application framework which would become the equivilent of Swing in the browser. Sun also wanted to replace Struts, and the word is that this resulted in some contention with the Apache group. Things went stale with bureaucracy for about a year. Somewhere along the line, Sun pulled the brain behind Struts, Craig McClannahan, onto the JSF project to evangelize for them, along with some of the members of the Swing team. Meanwhile, Microsoft was gaining momentum with their .Net web framework…

So suddenly the JSF team were behind schedule before they had really started, and had to somehow mix .Net Webforms with Struts and Swing and produce it quickly. The mandate from Sun is to make this an official part of the J2EE stack and it must be built on JSPs and servlets. (However, the display technology is interchangeable. JSF apps can be front-ended by J2ME, XSTL, Velocity, Applets and Swing clients, as well as the default HTML.)

So what do we have now? JSF v1.101 - A Face with no features!

With JSF we have a framework for a component-oriented UI system – but with very few UI components! The philosophy – this is a reference implementation for J2EE application server providers to implement, enhance and extend.
JSF has introduced an object model and an event model into the fray. We have formatters and converters. Certainly better than Struts which makes us convert everything on a form into a String on its way out and back into it’s native datatype on the way back in. Without an in-built formatting component, this makes life for many Struts developers pretty miserable.
The system is an extensible reference implementation and Sun is waiting for the implementers (e.g. BEA, IBM, and the Open Source Community) to spice up their life by filling in the gaps.
However, the things that make JSF very compelling when you’re struck in between a rock (Struts) and a hard place (adopting a totally new framework) are:
- I can treat every thing on my web form as an object in a hierarchy
- I don’t have to write HTML TABLES much anymore
- When I click on something I can directly write a handler for it, with much less wiring (as in Struts)
- I can integrate Struts with this and replace bits of an existing app one at a time

The itches are:
- I may well have to write my own web interface components (but we do that anyway and it’s not all bad. At least it’s encapsulated, reusable code)
- There’s another new set of JSP tags to learn
- There is the equivalent of Struts config with a different (but better) syntax (My itches with Struts-config make me sore – so I won’t go there.)

The recommendation from the presenter of the JSF presentation, David Geary, who wrote the book Core JSF for Sun, is to use JSF with Spring and Hibernate to develop the next generation of J2EE apps.

I've got some reading to do...

No comments: