2.1.2. Facelets Support

This section will perform you all concepts that JBDS involves to use the Facelets.

The Facelets extends JavaServer Faces by providing a lightweight framework that radically simplifies the design of presentation pages for JSF. JBoss Developer Studio provides support for Facelets in a variety of ways:

  • The New JSF Project wizard contains templates for creating Facelets projects based on version 1.2 of the JSF Reference Implementation. Select the JSF 1.2 with Facelets in JSF Environment section.

Choosing Facelets Environment

Figure 2.2. Choosing Facelets Environment


Once you select the environment, you can specify the one of three available templates:

Choosing Facelets Template

Figure 2.3. Choosing Facelets Template


The fallowing table lists possible Facelets templates for any JSF project and gives a proper description for each one.

Template

Description

FaceletsBlankWithoutLibs

Some servers already provide jsf libs and you take risk of getting conflicting libraries while deploying your project. To avoid such conflicts, use a template without libs if you have a server with its own jsf libraries

FaceletsKickStartWithRILibs

a sample application with Facelets that is ready to run

FaceletsKickStartWithoutLibs

a sample application without libraries

Table 2.1. Facelets Templates


Facelets Components

Figure 2.4. Facelets Components


  • Code assist (Ctrl + Space) for Facelets tags is available when editing .xhtml files.

XHTML File Code Assist

Figure 2.5. XHTML File Code Assist


What's more, code assist is also available for "jsfc" attribute in any HTML tag.

Code Assist for Jsfc Attribute

Figure 2.6. Code Assist for Jsfc Attribute


After selecting "jsfc" you get the code assist for JSF components available on a page.

Code Assist for JSF Components

Figure 2.7. Code Assist for JSF Components


When a component is chosen you will see all available attributes for it.

Available Attributes for the Component

Figure 2.8. Available Attributes for the Component


  • JBDS provides Eclipse's OpenOn feature for editing Facelets files. Using this feature, you can easily navigate between the Facelets templates and other parts of your projects. Just by holding down the Control key while hovering the mouse cursor over a reference to a template, the reference becomes a hyperlink to open that template.

Template Hyperlink

Figure 2.9. Template Hyperlink