Search code examples
javajspjsfjsf-2facelets

Are there any drawbacks of using technology JSP(instead XHTML) in JSF-2.0?


I used to working with JSP as view technology. But with JSF-2.0, the new push is for developers to use Facelets as their templating technology. But whether this is a serious matter? Will I lose anything if i will continue to use the JSP for views in JSF? Than exactly this technology is better? Is there any fundamental differences between the work XHTML and JSP? I would be very grateful if someone could answer it! Thank you


Solution

  • New view scope and the inclusion of Facelets is major improvements of JSF along with support ajax and annotations. This technology is a very important and powerful property in the JSF 2.0. So I would not recommend ignore it without having a necessity.

    JSP is discouraged from JSF 2.0, because Facelets provide with a much clearer and flexible mechanism for developing user interfaces than legacy JSP. Facelets are far better for several basic reasons:

    • Facelets tags don't need declaration in a tag library descriptor file(TLD).
    • Attributes in a tag are dynamic and they automatically get mapped to a properties. This is one of the main features not available in JSP is page.
    • Very usable page-templating feature. You define a template that defines a generic layout to all the view pages with the scope for customization.
    • JSP-side of the JSF specification is standing still. None of the new features that involve new tags (composite components, ajax, system events, etc…) are exposed through JSP.
    • In addition, Facelets are faster in execution than JSPs.

    In general, JSP as view technology in JSF 2.0 is considered more trouble and difficult to maintain