Creating Composite Components
See Also
JSF 2.0 has simplified the process of creating composite user interface (UI)
components, which can be reused in web pages. You can use the IDE's Composite
Component wizard to generate a Facelets template for a JSF composite component.
You can access the Composite Component wizard from the JavaServer Faces category
in the IDE's File wizard (Ctrl-N). However, a more intuitive way to prompt the
wizard is by highlighting the code snippet from a Facelets page in the editor,
then choosing Convert to Composite Component from the right-click menu.
To create a new composite component:
- Open a Facelets page contained in your project. (In the Projects window,
double-click any Facelets Page node to open it in the editor.)
- In the editor, highlight the snippet you want to create a component from.
- Right-click the highlighted snippet and choose Convert to Composite
Component. The Composite Component wizard opens, containing the selected
snippet in its Implementation Section panel.
- In the File Name field, type in a name for the composite
component.
- In Location, specify the top-level location for the file.
('Web Pages' is the default option, and places the file in the project's
web root.
- In Folder, specify a folder that will contain the composite
component. The
resources/ezcomp
folder is provided by default.
If the folder does not already exist, the wizard creates it.
The Created File field provides a read-only path to the new
location for the component.
- Click Finish. The new composite component source file is generated in the
specified location, and a new component tag is inserted into the location
in the editor where you highlighted the snippet. The namespace for the
component is also automatically added to the page's
<html>
tag.
- See Also
- Creating JSF Pages
- Editing JSF Pages
- Creating Managed Beans
- About JavaServer Faces Framework Support
Legal Notices