Library | Description |
---|---|
cc |
Describes the Facelets2 tag library used for declaring and defining the usage contract for composite UI Components. When authoring a composite component, use of this tag library is largely optional, though always recommended. Declaring and defining a composite component with this taglib provides valuable information about the component that can be used by tools and users of the composite component. In most cases, a composite component can be authored without declaring and defining its usage contract with this taglib. Creating a Composite ComponentA composite component is declared by creating a Facelets2 file inside of a resource library. (See section JSF.2.6 of the specification prose document for more information about resource libraries.) A composite component must reside within a resource library. It is not possible to create a composite component without putting it inside of a resource library. The default XML namespace URI of the taglib that contains the
composite component, for use in the using page, is
This declares that any Facelets2 file in the resource
library called
The implementation must also support declaring the namespace of the tag library in a JSF VDL tag library descriptor. This descriptor file is optional and is useful for component vendors that do not want to use the default XML namespace. This version of the proposal currently uses the facelet taglib descriptor syntax. For example:
Components from that taglibrary may be used in a using page by declaring them in the XML namespace for that view:
The values for attributes in a composite component VDL file can be
fully localized by putting them inside a ResourceBundle in the same
directory as the VDL view and accessing them with the per-component
resource bundle syntax. Consider the file
In this case, In the same
The normal localization rules for Refer to the |
f |
The core JavaServer Faces custom actions that are independent of any particular RenderKit. |
p |
Facelet tag attributes in
this namespace must be added to the pass through attribute map Usage example
Would cause |
jsf |
The presence of an Please see the documentation for Java class |
ui |
The tags in this library add templating — a powerful view composition technique — to JSF. Templating is so useful that there are entire frameworks, such as Tiles and SiteMesh, that are built around the concept of templating. So what is templating, how can you benefit from it, and how does this tag library implement it? If you've used JSP before, you've probably used This tab library contains a tag — A Templating ExampleFirst, we define a template:
In the preceeding listing, we've defined a layout, also known as a
template. That template uses the
The title, heading, and content pieces of the page referenced in the template are defined in a separate XHTML file in a composition, like this:
At runtime, JSF synthesizes the two previous XHTML pages to create a
single JSF view by inserting the
pieces defined in the composition into the template (that template is
layout.xhtml, which is the first
listing above). JSF also disregards everything outside of the So why do we have two XHTML pages to define a single view? Why not simply take the pieces and manually insert them into the layout so that we have only a single XHTML page? The answer is simple: we have separated layout from the content so that we can reuse that layout among multiple compositions. For example, now we can define another composition that uses the same layout:
By encapsulating the layout, we can reuse that layout among multiple
compositions. Just like
|