Facelets

As we mentioned in this chapter's introduction, the default view technology for JSF 2.0 and newer versions is Facelets. Facelets need to be written using standard XML. The most popular way to develop Facelet pages is to use XHTML in conjunction with JSF-specific XML namespaces. The following example shows how a typical Facelet page looks:

<?xml version='1.0' encoding='UTF-8' ?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 <html xmlns="http://www.w3.org/1999/xhtml" 
      xmlns:h="http://java.sun.com/jsf/html"                         xmlns:f="http://java.sun.com/jsf/core">     <h:head> 
        <title>Enter Customer Data</title> 
    </h:head>       <h:body>         <h:outputStylesheet library="css" name="styles.css"/> ...

Get Java EE 8 Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.