JBoss.orgCommunity Documentation
We don't lock you into any one JavaServer Faces implementation. You can always select the one which is necessary for you while creating a new JSF project, adding JSF capability to any existing Eclipse project or importing existing JSF projects as well.
At this point the spacial wizard will prompt you to specify a proper JSF environment. It may be JSF 1.1.02 RI or JSF 1.2 which is integrates a number of new features and changes. 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 a proper JSF environment all the required libraries for the selected version will be added to your project.
In this section we will focus more on all concepts that are integrated for working with Facelets.
The Facelets extends JavaServer Faces by providing a lightweight framework that radically simplifies the design of presentation pages for JSF. 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, just create a project with Facelets based on version 1.2 of the JSF Reference Implementation, i. e. select the JSF 1.2 with Facelets in the JSF Environment section of the New JSF Project wizard.
Once you've selected the environment, it's possible to specify the one of three available templates:
The following table lists possible templates with Facelets for any JSF project and gives a proper description for each one.
Table 2.1. Facelets Templates
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 |
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, the tip includes a detailed description of the tag component, the syntax and available attributes.
One more feature which comes with Facelets support is code assist (Ctrl + Space). It is available for Facelets tags while editing .xhtml files.
What's more, code assist is also available for "jsfc" attribute in any HTML tag.
After selecting "jsfc" you get the code assist for JSF components available on a page.
When a component is chosen you will see all available attributes for it.
Finally, Eclipse's OpenOn feature for editing Facelets files is supported. 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.