Using Facelets Templates

See Also

You can create Facelets Templates for your JSF 2.0 application using the Facelets Template wizard. The wizard creates an XHTML template file using <h:head> and <h:body> tags, and places associated stylesheets in the resources/css folder of your application's web root. You can choose from eight unique layout styles, and specify whether the layout is implemented using CSS or an HTML <table> element.

After you create a Facelets template, you can use the Facelets Template Client wizard to generate pages that reference the template. The client will be formatted according to the referenced template.

To create a new Facelets template:

  1. In the Projects window, right-click your project node and choose New > Facelets Template. The Facelets Template wizard opens.

    (If Facelets Template is not listed, choose Other. Then select the JavaServer Faces category and Facelets Template file type. Click Next.)

  2. In the File Name field, type in a name for the template.
  3. In Location, specify the top-level location for the file. ('Web Pages' is the default option, and places the file in the given project's web root.
  4. In Folder, specify a folder within the selected location, if you require. The Created File field provides a read-only path to the new location for the template file.
  5. For Layout Style, specify whether you want the layout to be generated using CSS styles or an HTML table.
  6. Select the icon that corresponds to the layout you want generated. (A black layout icon indicates that the icon is selected.)
  7. Click Finish. The new Facelets template is generated and opens in the editor. The wizard generates a default.css file, and a cssLayout.css or tableLayout.css file, depending on your layout selection.
See Also
Creating JSF Pages
Editing JSF Pages
Creating a New Application with JSF Support
About JavaServer Faces Framework Support

Legal Notices