Java Reference
In-Depth Information
to Boolean . In addition, some component data must be bound to properties of a partic-
ular type. For example, a UISelectBoolean component must be bound to a property
of type boolean or java.lang.Boolean .
Sometimes you might want to convert a component's data to a type other than a standard
type, or you might want to convert the format of the data. To facilitate this, JavaServer
Faces technology allows you to register a javax.faces.convert.Converter
implementation on UIOutput components and components whose classes subclass
UIOutput . If you register the Converter implementation on a component, the Con-
verter implementation converts the component's data between the two views.
You can either use the standard converters supplied with the JavaServer Faces imple-
mentation or create your own custom converter. Custom converter creation is covered in
Chapter 6 , Creating Custom UI Components and Other Custom Objects .
Event and Listener Model
The JavaServer Faces event and listener model is similar to the JavaBeans event model in
that it has strongly typed event classes and listener interfaces that an application can use
to handle events generated by components.
The JavaServer Faces specification defines three types of events: application events, sys-
tem events, and data-model events.
Application events are tied to a particular application and are generated by a UICom-
ponent . They represent the standard events available in previous versions of JavaServer
Faces technology.
An event object identifies the component that generated the event and stores information
about the event. To be notified of an event, an application must provide an implementation
of the listener class and must register it on the component that generates the event. When
the user activates a component, such as by clicking a button, an event is fired. This causes
the JavaServer Faces implementation to invoke the listener method that processes the
event.
JavaServer Faces supports two kinds of application events: action events and value-
change events.
An action event (class javax.faces.event.ActionEvent ) occurs when the user
activates a component that implements
javax.faces.component.ActionSource . These components include buttons
and hyperlinks.
Search WWH ::




Custom Search