First page Back Continue Last page Graphics

Creating a Page Template


Creating a Page Template (continued)

After you close the Create JSF Page Template dialog box, the page template opens in the visual editor. You can add components by dragging them from the Component Palette, and you use the Property Inspector to set properties on components to affect appearance and behavior. You can bind components to data. You can also add regions or portlets.

In addition, you can add attributes to the page definition that are accessible via Expression Language (EL). For example, the page definition may define a title attribute and place the title in a specific place on the page. The user of this template would only need to define the text for the title attribute, which would then appear in the correct place on the page.

Page templates typically have static areas that cannot be changed and dynamic areas where developers can place content specific to the page they are building. The example in the slide shows a header, menu regions, and a news portlet that appear on all pages that use this template.

The template developer can also place on the page a FacetRef, which is a placeholder for content on the page where this template is used. The sections labeled A and B in the example are facets, or placeholders, where the page developer who uses this template can drop content. This content could be any JSF component, region, or portlet.

By using a template to create a page, you save time and duplicated effort because you do not have to rebuild areas that are common across multiple pages, and you also ensure consistency across the application.