Wednesday, October 26, 2011

Java Tutorial Highlights - JSF Templating

From the Java Tutorial here.

JavaServer Faces technology provides the tools to implement user interfaces that are easy to extend and reuse. Templating is a useful Facelets feature that allows you to create a page that will act as the base, or template, for the other pages in an application. By using templates, you can reuse code and avoid recreating similarly constructed pages. Templating also helps in maintaining a standard look and feel in an application with a large number of pages.

Table 5-2 lists Facelets tags that are used for templating and their respective functionality.



Table 5-2 Facelets Templating Tags



















































TagFunction
ui:componentDefines a component that is created and added to the component tree.
ui:compositionDefines a page composition that optionally uses a template. Content outside of this tag is ignored.
ui:debugDefines a debug component that is created and added to the component tree.
ui:decorateSimilar to the composition tag but does not disregard content outside this tag.
ui:defineDefines content that is inserted into a page by a template.
ui:fragmentSimilar to the component tag but does not disregard content outside this tag.
ui:includeEncapsulate and reuse content for multiple pages.
ui:insertInserts content into a template.
ui:paramUsed to pass parameters to an included file.
ui:repeatUsed as an alternative for loop tags, such as c:forEach or h:dataTable.
ui:removeRemoves content from a page.

For more information on Facelets templating tags, see the documentation at http://download.oracle.com/javaee/6/javaserverfaces/2.1/docs/vdldocs/facelets/.

The Facelets tag library includes the main templating tag ui:insert. A template page that is created with this tag allows you to define a default structure for a page. A template page is used as a template for other pages, usually referred to as client pages.

No comments:

Post a Comment