What is the difference between JSF and Facelets?
Asked Answered
D

3

20

I am following the Java EE6 tutorials and I don't understand the difference between JSF and Facelets. Chapter 4 goes has a section 'Developing a Simple JavaServerFaces Application' and Chapter 5 has a section 'Developing a simple Facelets' application and as far as I can see both these examples use the exact same process - an .xhmtl page for the markup, a backing bean to hold some data and then a web.xml file that maps urls to the 'FaceletsServlet'.

From what I can gather Facelets are .xhtml pages with tags such as <h:head> and <h:inputText> used to mark up the webpages.

But then what is JSF? I have read that either JSP or Facelets can be used with JSF so does that mean the role of JSF is to provide the tag libraries that are used by JSP or Facelets?

Dalston answered 12/7, 2012 at 17:57 Comment(1)
possible duplicate of What is the difference between JSF, Servlet and JSP?Calista
P
33
  • JSF - Java Server Faces is the overarching application development framework. It contains many aspects, one of which is the view handler. JSF (Wikipedia), JSF (Stack Overflow).

  • Facelets is a view handler for JSF. Before JSF 2.0, JSP was the default view handler, but the problem was JSP didn't work very well with JSF's component based framework. Facelets was designed from the ground up to work well with JSF. Facelets (Wikipedia), Facelets (Stack Overflow)

Tag libraries are a different part of the JSF spec. They are collections of UI components. Facelets is not a taglib, and many tag libs can be used with Facelets.

Parlay answered 12/7, 2012 at 19:13 Comment(0)
R
13

JSF is as you probably already gathered a component based system. These components are organized in libraries.

JSF is the base standard and defines the standard taglibs core and html. These include the tags for such basic elements as input fields, buttons, labels and links. Facelets is the facelets taglib, it was originally distributed seperatly but now it is included in the JSF standard. Facelets contains tags like ui:composition, ui:insert and ui:define that can be used for templating. There are many other tag libraries that can be used with JSF like primefaces, richfaces, tomahawk and trinidad.

Residency answered 12/7, 2012 at 18:24 Comment(0)
E
3

JSF is used with Facelets, before we were using jsp. Facelet is a view technology based on xml.

Facelets was originally created as a separate, alternative view declaration language for JSF 1.1 and JSF 1.2 which both used JSP as the default view declaration language. Starting from JSF 2.0, Facelets has been promoted by the JSF expert group to be the default view declaration language. JSP has been deprecated.

Important features facelets provides are templating, composite components, content reuse.

http://www.ibm.com/developerworks/library/j-facelets/

Exhaustive answered 26/3, 2013 at 10:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.