Search code examples
jsfjstlfaceletsmyfacestrinidad

Explain to me the different JSF component libraries relate


Even though i spend whole days developing a JSF application, i've never had any training on the matter and I have to admin I am a still confused how the whole JSF puzzle fits together. JSF just looks a bit thrown together to me.

  • jsf-api
  • jslt
  • facelets
  • myfaces
  • trinidad
  • tobago
  • jsp api

I'd be very grateful if anyone could give me a quick description of these components, which ones are standard, which ones can be left out, which ones can/need to be used together


Solution

  • JSP and JSTL

    JSP has undergone many iterations, but this is the core Java EE dynamic page technology. This is a servicable API, but working with JSPs often means more manual management of code/resources.

    JSTL is the JSP Standard Template Library. This is a set of standard JSP tags. Do not mix these tags with JSF tags; they belong to a different programming model.

    JSF API

    The JSF specification. This is the core of the JSF Model-View-Presenter framework. This specifies a simple set of core components and the core lifecycle artefacts. There are two widely known implementations: Mojarra (the open sourced Sun API) and Apache MyFaces. Part of Java EE 5 and above.

    Facelets

    A view technology designed for JSF. Use this instead of JSPs. You cannot use JSP tags in Facelets views. This is not standard in Java EE 5, but is standardized in JSF2 (and therefore the upcoming Java EE 6). The better templating provided by Facelets often means you can rely less on 3rd party libraries.

    Facelets provides some tags that look like JSP JSTL tags, but don't share any code. These tags should generally be avoided too (see Facelets doc for advice).

    Apache Trinidad and Tobago

    These are JSF libraries that provide components and other facilities. Because the core set of controls is rather basic, it is common to use such libraries, especially if Facelets is not used. These are not part of the Java EE standard. Library compatibility varies. See also jsfmatrix.net.