HTML and CSS Reference
In-Depth Information
Chapter 4
JSF Under the Hood—Part 3
In this chapter, you will learn in detail how to empower your JSF applications by understanding the JSF event model.
After you finish this chapter, you will understand the different JSF event types (JSF Faces events, Phase events, and
System events). You will learn how to work with JSF events in your JSF applications. And in the last section, you will
learn how to utilize the JSF view parameters in order to produce RESTful JSF pages that can be bookmarked by the
end users and can be indexed by web search crawlers.
JSF Events
Before going into the details of JSF events, we need to understand first what an event is and what an event listener is.
An event is usually an action performed by the user (such as clicking a button or changing a drop-down value).
When an event occurs, a change (or set of changes) in the event source object occurs and is captured in an event
object. The event object should tell what the source object of the event is and what changes to the event source (if any)
occur. An event listener is usually a class that must be notified when a specific event (that the event listener class is
interested in) occurs.
Generally, in the Java world, the two main components in the event model are represented as one interface and
one class, as shown in Figure 4-1 .
Figure 4-1. Java event model main interfaces
EventListener is a tagging interface with no methods that all of the event listener interfaces must extend,
while EventObject class has mainly one method, getSource() , which returns the object on which the event initially
occurred (the event source). Coping with the Java event model, JSF utilizes both EventObject and EventListener for
building its event and listener model.
In order to define JSF listeners, all of the JSF listener interfaces extend EventListener interface. Figure 4-2 shows
the main JSF event listeners (note that this diagram does not show the complete list of JSF listeners for simplicity).
Search WWH ::

Custom Search