Sunday, July 4, 2010

icefaces without icefaces

First thing you think when starting with JSF is how to customize look and feel and add some javascript. JSF itself is not friendly to CSS and Javascript,
for number of reasons:
  • ids of elements are dynamic, so your script will have difficulties to find it.
  • components hide actual html  from you, you discover it after page is rendered
  • css styles are not 'visible' to programmer.
  • actual html parts of a component are almost impossible to change.
Adding ajax  to jsf page is not an easy task. Defining ajax on component level makes your view depends on too many javascripts and you model becames ajax-depended and not-testable.

Icefaces comes with great solution to ajax. It comes with tons of components, which are great but still difficult to change. For example, tab container render tabs with 'table-tr-td' and quite limited in terms of customization.

I believe in another approach. Instead of using complex jsf components, write FACELETS.
Reuse your html parts, especially if your skill CSS skills concentrated in hands of one person.
Sure, simple components like h:inputText are perfectly ok.

Complex components like tabs, tables, trees, menues, popups all can be done in css-html.
Turn your html into facelets, create tag library for you facelets and you will benefit from flexibility in long run.

So if Icefaces's components are not suit you, still do use Icefaces.... without its component.
95% of Icefaces is its AJAX engine. 4% is Push mechanizm.

When you have free hands to html-design, JSF became your friend forever.