Comparing Facelets and JSP
Before we can appreciate the advantages that Facelets brings to a JSF application, let's consider the role of JSP as the presentation technology for JSF. By default, the JSF ViewHandler mechanism uses JSP. The ViewHandler is an infrastructural component of the JSF framework that performs an important role during the request processing lifecycle, specifically during the Render Response and Restore View phases. The ViewHandler is responsible for creating, restoring, and rendering the UI component tree for the current view.
JSP was originally designed to solve the problem of how to include dynamic content in a static HTML document. JSPs enable dynamic content to be inserted into an HTML document through the use of scriptlets, expressions, and JSP directives.
These are typically blocks of Java code interspersed with HTML markup. When the JSP page is requested by the browser, the Servlet/JSP container generates a Java servlet from the JSP source code, compiles it, and...