The Java EE 6 Tutorial, Volume I

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. Commonly used core tags are listed in Table 7–5 along with the functions they perform.

Table 7–5 The Core Tags

Tag Categories 

Tags 

Functions 

Event-handling tags 

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 backing bean when a form is submitted 

f:valueChangeListener

Adds a value-change listener to a parent component 

Attribute configuration tag

f:attribute

Adds configurable attributes to a parent component 

Data conversion tags

f:converter

Adds an arbitrary converter to the parent component 

f:convertDateTime

Adds a DateTime converter instance to the parent component

f:convertNumber

Adds a Number converter instance to the parent component

Facet tag

f:facet

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

f:metadata

Registers a facet on a parent component

Localization tag 

f:loadBundle

Specifies a ResourceBundle that is exposed as a Map

Parameter substitution tag

f:param

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

Tags for representing items in a list 

f:selectItem

Represents one item in a list of items in a SelectOne or SelectMany component

f:selectItems

Represents a set of items in a SelectOne or SelectMany component

Validator tags

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 instance to a component 

f:validateBean

Delegates the validation of a local value to a BeanValidator instance 

f:validateRequired

Enforces the presence of a value in a component 

Ajax tag  

f:ajax

Associates Ajax action to a single or group of components based on placement 

Event tag 

f:event

Allows installing ComponentSystemEventListener on a component

These tags, which are used in conjunction with component tags, are explained in other sections of this tutorial. Table 7–6 lists the sections that explain how to use specific core tags.

Table 7–6 Where the Core Tags Are Explained

Tags 

Where Explained 

Event-handling tags

Registering Listeners on Components

Data conversion tags

Using the Standard Converters

facet

Using Data-Bound Table Components and Laying Out Components With the Panel Component

loadBundle

Rendering Components for Selecting Multiple Values

param

Displaying a Formatted Message With the h:outputFormat Tag

selectItem and selectItems

Using The SelectItem and SelectItems Components

Validator tags

Using the Standard Validators