9

I am in need of getting up to speed with JSF 2.0. I have found a nice and practical tutorial at JSF tutorial. This tutorial covers creating JSF applications using JSPs (JSF 1.2). At our place we are using JSF 2.0 and building with Facelets. When studying a tutorial using JSPs what are the pitfalls and differences I need to be aware of when having to do things with Facelets ?

1

2 Answers 2

5

The great thing about Facelets vs. JSP as a view technology for JSF is that facelets respect the entire jsf lifecycle whereas with JSP you have the two lifecycles competing (JSF vs. JSP).

With JSP, you may be tempted to use other tag libraries (like JSTL) which may not behave as you are expecting due to the differences in the lifecycle. Some of the JSTL tags have been converted to facelet tags, but even then there are generally suitable pure JSF replacements for them (like ui:repeat in place of c:foreach)

If you are doing JSF 2.0, use facelets and you'll never look back.

2
1

Facelets are generally nice to work with.

The major difference in JSF 2.0 compared to earlier versions is that you can directly invoke Java methods easily from EL, making it much easier to do logic operations and information passing in the JSF snippets themselves.

1
  • 1
    This is not exactly JSF 2.0 specific. EL 2.2 / JBoss EL works as good with JSF 1.x. It's however true that JSF 2.0 is part of Java EE 6 which in turn contains EL 2.2.
    – BalusC
    Sep 29, 2011 at 18:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.