Creating Facelet pages (JSF 2.0)

After you create a web project that is enabled for JSF 2.0, you can create the Facelet pages that are the web pages in your project. A Facelet page is an XHTML file.

Before you begin

Before you create a Facelet page you must create a web project that is enabled for Facelet technology. For more information, refer to Creating Facelet-enabled web projects (JSF 2.0).

Procedure

  1. Right-click your Facelet-enabled web project and select New > Web Page.
  2. Name the file and accept the default folder.
  3. In the Template list, ensure that you select the Facelet basic template.

  4. Click Finish.

Results

In the Source pane of the editor, your Facelet page has a <h:head> followed by a <h:body> tag. These tags behave similarly to HTML <head> and <body> tags.

After the XHTML file opens in the editor, the Standard Faces Components drawer opens in the Palette view next to the new page. The Facelet Tags drawer is available in the Palette view. If you do not see the palette, click Window > Show View > Basic > Palette. The Palette contains the drawers that have all of the UI components that you can drag and drop onto your XHTML file.

Tip: You can convert regular XHTML files in a Facelet-enabled web project to Facelet pages. The page must have the *.xhtml extension. When you drag a Facelet component from the palette to the XHTML page, the page is automatically converted to a Facelet page. You are prompted to save and reload the page.

Feedback