JSF: The Good, the Bad, and Yes, the Ugly

DZone 's Guide to

JSF: The Good, the Bad, and Yes, the Ugly

· Java Zone ·
Free Resource

Having bagged on JSF quite a bit (mostly for its glacial feature pace), still, after squirming around with it, I find myself liking where it ends up going. This is in large part because I am a big believer in a. binding, b. components, and c. pages that don‘t contain any code. When I get to the finish stage on most ui pieces, I end up doing lots of starts, tuning CSS. Should probably think about taking the html out and fiddling with it in another tool. Thoughts on that are welcome.

In the most recent JSF tour, we were doing a wizard and had to bind to checkboxes. That turned into a nightmare, and for all the typical JSF reasons. JSF gets a low grade for heuristics (intuition is rarely the road to figuring things out). For instance, what would you think would happen if:

  1. had an entity that has one or more features
  2. those features each are modeled as Enums
  3. you want to give the User the ability to checkoff the ones that apply for the given instance of said Entity

Surely, a framework that has been around for 8 years should have no problem with this. Well, in fact, it doesn‘t work. It makes sense that the great Enum converter (more on that, somehow the for-class doesn‘t work on that anymore), would not work for this binding since we are doing a collection, but is this really that complicated? First inclination was to make an EnumSetConverter, after all, the individual Enums were being converted (to its own string format :: (makes you nostalgic for C++)). So the EnumSetConverter would just have one additional step: first split on space (since each selected feature will come in one string with spaces between), then with each token, just invoke the normal EnumConverter.

But that didn‘t work. Turns out there‘s a bug in the 1.2 RI and the converter never gets called. More surprisingly, in the bug discussion, they say that they are going to drop support for converters on checkboxes. The problem is that this leaves you having to bind to some intermediary value, and then perform nothing more than a straight conversion (or write your own component that does support a converter).

From http://www.jroller.com/robwilliams


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}