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 ?
2 Answers
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.

- 26,265
- 15
- 89
- 115
-
For other information on what has changed in JSF 2 (besides facelets, have a look at http://andyschwartz.wordpress.com/2009/07/31/whats-new-in-jsf-2/ – digitaljoel Sep 29 '11 at 17:39
-
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.

- 73,784
- 33
- 194
- 347
-
1This 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 '11 at 18:02