JBoss.orgCommunity Documentation
JSF Tools does not lock you into any one JavaServer Faces implementation. You can always specify the desired JavaServer Faces implementation while creating a new JSF project (see Section 3.1, “Creating a New JSF Project”), adding JSF capability to any existing Eclipse project (see Section 3.3, “Adding JSF Capability to Any Existing Project”), or importing existing JSF projects (see Section 3.2, “Importing Existing JSF Projects with Any Structure”).
At this point the special wizard will prompt you to specify an appropriate JSF environment. It may be JSF 1.1.02 RI, JSF 1.2 or JSF 2.0. The wizard also lets you select JSF implementation with a component orientation such as JSF 1.2 with Facelets or MyFaces 1.1.4.
After specifying an appropriate JSF environment, all the required libraries associated with the selected version will be added to your project.
In this section we will focus all the concepts that relate to working with Facelets.
Facelets extend JavaServer Faces by providing a lightweight framework that radically simplifies the design of JSF presentation pages. Facelets can be used in a variety of ways that we will consider further in this section.
If you want to build an application using Facelets, create a project with Facelets based on version 1.2 of the JSF Reference Implementation, i. e. select the JSF 1.2 with Facelets option in the JSF Environment section of the New JSF Project wizard.
Once you have selected the environment, it is possible to specify one of three available templates:
The following table lists the templates that can be used with Facelets for any JSF project, and gives a detailed description for each one.
Table 2.1. Facelets Templates
Template |
Description |
---|---|
FaceletsBlankWithoutLibs |
Some servers already provide JSF libs and you risk library conflicts 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. |
The JBoss Tools Palette comes with the Facelets components ready to use. A useful tip appears when you hover the mouse cursor over the tag; this tip includes a detailed description of the tag component, the syntax and available attributes.
JSF Tools provides Facelets code assistance, which can be accessed by pressing Ctrl+Space. It is available for Facelets tags while editing .xhtml
files.
Code assist is also available for jsfc
attributes in any HTML tag.
After selecting an jsfc
attribute, the code assist feature will list the JSF components available on a page.
When a component is selected you will see all available attributes for it.
Finally, JSF Tools supports Eclipse's OpenOn™ feature while editing Facelets files. Using this feature, you can easily navigate between the Facelets templates and other parts of your projects. By holding down the Ctrl key while hovering the mouse cursor over a reference to a template, the reference becomes a hyperlink to navigate to that template.