Java Reference
In-Depth Information
A value-change event (class javax.faces.event.ValueChangeEvent ) occurs
when the user changes the value of a component represented by UIInput or one of its
subclasses. An example is selecting a check box, an action that results in the component's
value changing to true . The component types that can generate these types of events are
the UIInput , UISelectOne , UISelectMany , and UISelectBoolean compon-
ents. Value-change events are fired only if no validation errors are detected.
Depending on the value of the immediate property (see “ The immediate Attribute in
The Java EE 6 Tutorial: Basic Concepts ) of the component emitting the event, action
events can be processed during the invoke application phase or the apply request values
phase, and value-change events can be processed during the process validations phase or
the apply request values phase.
System events are generated by an Object rather than a UIComponent . They are gen-
erated during the execution of an application at predefined times. They are applicable to
the entire application rather than to a specific component.
A data-model event occurs when a new row of a UIData component is selected.
There are two ways to cause your application to react to action events or value-change
events that are emitted by a standard component:
• Implement an event listener class to handle the event and register the listener
on the component by nesting either an f:valueChangeListener tag or an
f:actionListener tag inside the component tag.
• Implement a method of a managed bean to handle the event and refer to the method
with a method expression from the appropriate attribute of the component's tag.
See Implementing an Event Listener ” on page 117 for information on how to implement
an event listener. See “Registering Listeners on Components” in The Java EE 6 Tutorial:
Basic Concepts for information on how to register the listener on a component.
See “Writing a Method to Handle an Action Event” in The Java EE 6 Tutorial: Basic Con-
cepts and “Writing a Method to Handle a Value-Change Event” in The Java EE 6 Tutorial:
Basic Concepts for information on how to implement managed bean methods that handle
these events.
See “Referencing a Managed Bean Method” in The Java EE 6 Tutorial: Basic Concepts
for information on how to refer to the managed bean method from the component tag.
When emitting events from custom components, you must implement the appropriate
event class and manually queue the event on the component in addition to implementing
an event listener class or a managed bean method that handles the event. “ Handling Events
for Custom Components on page 119 explains how to do this.
Search WWH ::




Custom Search