Version 8

    With JEE5, JSF and JSP work better together.  Is there still any reason to use Facelets?

     

     

    The Facelets Project provides an alternative to JSP for developers of JSF applications.  The project was created, in large part, to address some limitations and plain old brokenness of JSP when used with JSF.  See "Improving JSF by Dumping JSP".

     

    But the combination of JSF 1.2, JSP 2.1, and JSTL 1.2 fixes the main problems that Facelets addressed.  For details on that see JSF 1.2 feature summary.  So now the question is, "Are there still advantages to using Facelets instead of JSP?"  This wiki tries to address that question.

     

     

    Facelets Advantages

    • Built from the ground up to be a view technology for JSF.  JSP 2.1 had to be re-architected to properly support deferred expressions, Unified EL, and content interweaving.

    • Tapestry-like development.  You can use any plain HTML authoring tool to create Facelets pages.  This makes it easier to develop the view outside the container.

    • You can modify or replace the ExpressionFactory.  This allows you to install your own version of the expression language or even integrate another EL such as OGNL.

    • It doesn't allow scriptlets.  In general, you don't have as much rope to hang yourself with because you don't inherit the "bad practices" that JSP allows.

    • Since pages are compiled/optimized for JSF up front, reducing overhead and increasing performance

    • Requires a small fraction of the time to incorporate custom Components into your pages

    • On each request, JSF is required to render you JSP in its entirety to determine how your Component tree and inline content relate, Facelets does this at compile time instead

    • Able to take advantage of innovations without going through a spec committee

    • Better error reporting

    • Compile-time EL validation

    • Lightweight API for TagHandler development

    • Can be used with JSF 1.1

    • Allows Mixing of Inline-EL with Components

     

    JSP 2.1 Advantages

    • It's a standard.  It will be fully supported by all JEE 5 vendors.

    • It's the standard view technology for JSF.  Most JSF technologies are tested and developed on JSP first.

    • More developers already know JSP.  So, you are more likely to be able to hire developers who are comfortable with it.

    • It allows scriptlets and and other "bad practices".  Let's face it, sometimes you just need to be able to do a little hacking.

    • It's already there with your JEE 5 container.  There is nothing extra to install or configure.

    • JSP has larger community support and oversight.

    • Requires development of a JSP Tag, with all possible attributes for your component, along with TLDs to incorporate new Components

    • Full JSTL support.  Facelets supports a subset of JSTL. (Note, mixing JSTL with JSF doesn't always work)

    • You are free to use other JSP Tag Libraries, Facelets has it's own API for Tags

    • Cannot handle mixing of Inline-EL with Components

     

     

    Referenced by: