Using Core Tags

The tags included in the JavaServer Faces core tag library are used to perform core actions that are not performed by HTML tags.

Table 10-8 lists the event-handling core tags.

Table 10-8 Event-Handling Core Tags

Tag

Function

f:actionListener

Adds an action listener to a parent component

f:phaseListener

Adds a PhaseListener to a page

f:setPropertyActionListener

Registers a special action listener whose sole purpose is to push a value into a managed bean when a form is submitted

f:valueChangeListener

Adds a value-change listener to a parent component

Table 10-9 lists the data-conversion core tags.

Table 10-9 Data-Conversion Core Tags

Tag

Function

f:converter

Adds an arbitrary converter to the parent component

f:convertDateTime

Adds a DateTimeConverter instance to the parent component

f:convertNumber

Adds a NumberConverter instance to the parent component

Table 10-10 lists the facet core tags.

Table 10-10 Facet Core Tags

Tag

Function

f:facet

Adds a nested component that has a special relationship to its enclosing tag

f:metadata

Registers a facet on a parent component

Table 10-11 lists the core tags that represent items in a list.

Table 10-11 Core Tags That Represent Items in a List

Tag

Function

f:selectItem

Represents one item in a list of items

f:selectItems

Represents a set of items

Table 10-12 lists the validator core tags.

Table 10-12 Validator Core Tags

Tag

Function

f:validateDoubleRange

Adds a DoubleRangeValidator to a component

f:validateLength

Adds a LengthValidator to a component

f:validateLongRange

Adds a LongRangeValidator to a component

f:validator

Adds a custom validator to a component

f:validateRegEx

Adds a RegExValidator to a component

f:validateBean

Delegates the validation of a local value to a BeanValidator

f:validateRequired

Enforces the presence of a value in a component

Table 10-13 lists the core tags that fall into other categories.

Table 10-13 Miscellaneous Core Tags

Tag Category

Tag

Function

Attribute configuration

f:attribute

Adds configurable attributes to a parent component

Localization

f:loadBundle

Specifies a ResourceBundle that is exposed as a Map

Parameter substitution

f:param

Substitutes parameters into a MessageFormat instance and adds query string name-value pairs to a URL

Ajax

f:ajax

Associates an Ajax action with a single component or a group of components based on placement

Event

f:event

Allows installing a ComponentSystemEventListener on a component

WebSocket

f:websocket

Allows server-side communications to be pushed to all instances of a socket containing the same channel name.

These tags, which are used in conjunction with component tags, are explained in other sections of this tutorial.

Table 10-14 lists the sections that explain how to use specific core tags.

Table 10-14 Where the Core Tags Are Explained

Tags

Where Explained

Event-handling tags

Data-conversion tags

f:facet

Using Data-Bound Table Components and Laying Out Components with the h:panelGrid and h:panelGroup Tags

f:loadBundle

f:metadata

f:param

f:selectItem and f:selectItems

Validator tags

Using the Standard Validators

f:ajax

f:websocket