Thursday, February 24, 2011

JavaServer Faces: Facelets

I've gone and done it: my first full, raging JEE-oriented tutorial, A Simple JSF Facelets Project, in almost three years. In that time I've chosen not to write formal tutorials for a lot of the sub-JEE technologies I've worked with since I felt that others had more than adequately covered the topics. Others like, and very especially, Lars Vogel.

However, I'm on my own again. Just as years ago I couldn't find a tutorial on JSP and servlets that worked (perhaps rather, I couldn't find any that still worked with the new releases of the Eclipse IDE and Web Tools Platform), I have been unable to find a tutorial on Facelets that works.

I've figured out what others have missed and have no explanation why they left their tutorials in a state of unworkability, but I have a theory. They just don't go back to show how to solve problems they forgot they had or answer questions others new to their topic will have, questions they had to answer for themselves, but moved on without taking notes. Their tutorials, once you've followed them and created a project in Eclipse, simply do not work. You're on your own. And others tell me that they've been unable to get anything to work either.

Well, as I'm fond of saying, I'm not the brightest Crayola® in the box. So, I have to take careful notes because often I find myself smack back in the same state of perplexity at why my Tomcat server won't start or why some JSF construct won't render. And if I don't know, there must be someone else who doesn't.

Recently, I exchanged mail with some guy from India who admitted to me that he had tried playing with JSF earlier last year, but just couldn't get things to work. His problem was the same as mine: libraries. The chaos in JSF/Facelet approaches needing JSTL, then no longer needing it in Faces 2.0, etc., libraries coming and going, what version of what library works with what version or versions of other libraries, etc. It's unconscionable. And without the seemingly innate intelligence of these tutorial and book authors who publish then run off to their next thing, I'm obliged to feel my way forward via trial and error, a process I loathe.

And that old, long-winded tutorial I wrote on JSP, servlets and setting up Eclipse? I still get e-mail out of the blue at least once per month thanking me for it. It's still relevant even though it's become mildly embarrassing after journeying so far down the Eclipse and JEE road. I need to rewrite it, to make it more relevant and fix the rather embarrassing admissions of perplexity in my explanations. Now that I know.

Today's tutorial also builds on two other, full-length articles I've written on exposing the recent research I've done on setting up a solid set of libraries to use for JSF, plus additional libraries for Facelets work.

And I show how to internationalize and localize the simple application.

Today's tutorial doesn't go as far as I'd like. I need to wax more forthcoming on aspects that need explaining. That requires much more effort and guesswork. There are also some navigational problems that would be more obvious if the little application did much more than it does. That's very important to fix.

But, I'm moving ahead with the next tutorial. It will be a demonstration of Facelet templating; I just haven't chosen what I'm going to show yet.

Down the road I have plans to integrate Spring web flow. It's a mountain of work I've set for myself.

No comments:

Post a Comment