The uri Attribute Value
The uri Attribute Value
The uri attribute value uniquely identifies the TLD. The prefix attribute value is used to
distinguish tags belonging to the tag library. You can use other prefixes rather than the h or f
prefixes. However, you must use the prefix you have chosen when including the tag in the page.
For example, the form tag must be referenced in the page using the h prefix because the
preceding tag library directive uses the h prefix to distinguish the tags defined in
html_basic.tld
:
<h:form ...>
A page containing JavaServer Faces tags is represented by a tree of components. At the root of
the tree is the UIViewRoot component. The view tag represents this component on the page.
Therefore, all component tags on the page must be enclosed in the view tag, which is defined in
the jsf_core TLD:
<f:view>
... other JavaServer Faces tags, possibly mixed with other
content ...
</f:view>
You can enclose other content, including HTML and other JSP tags, within the view tag, but all
JavaServer Faces tags must be enclosed within the view tag.
The view tag has four optional attributes:
A locale attribute. If this attribute is present, its value overrides the Locale stored in the
UIViewRoot
component. This value is specified as a String and must be of this form:
:
language:[{-,_}:country:[{-,_}:variant]
The language, country, and variant parts of the expression are as specified in
java.util.Locale
.
A renderKitId attribute. A page author uses this attribute to refer to the ID of the render kit
used to render the page, therefore allowing the use of custom render kits. If this attribute is
not specified, the default HTML render kit is assumed. The process of creating custom
render kits is outside the scope of this tutorial.
A beforePhase attribute. This attribute references a method that takes a PhaseEvent object
and returns void, causing the referenced method to be called before each phase (except
restore view) of the life cycle begins.
An afterPhase attribute. This attribute references a method that takes a PhaseEvent object
and returns void, causing the referenced method to be called after each phase (except restore
view) in the life cycle ends.
An advanced developer might implement the methods referenced by beforePhase and
afterPhase
to perform such functions as initialize or release resources on a per-page basis. This
feature is outside of the scope of this tutorial.
Setting Up a Page
Chapter 11 · Using JavaServer Faces Technology in JSP Pages
323