HTML and CSS Reference
In-Depth Information
As shown in the previous bolded line, using
<f:valueChangeListener>
is very similar to
<f:actionListener>
;
mainly, you need to specify the
type
attribute which refers to the fully qualified class name of the listener class.
Phase Events
Phase events occur in the beginning and ending of each standard phase of the JSF request processing lifecycle, as
shown in Figure
4-7
.
Figure 4-7.
Phase events execution time
Phase events are handled by phase listeners. As shown in Figure
4-4
,
Lifecycle
instance may have zero or more
attached phase listeners, and
UIViewRoot
can have from zero to two instances of phase listeners. In order to create
a phase listener, you need to implement the JSF
PhaseListener
interface. Listing 4-16 shows the code of the JSF
PhaseListener
interface.
Listing 4-16.
PhaseListener Interface
package javax.faces.event;
import java.io.Serializable;
import java.util.EventListener;
public interface PhaseListener extends EventListener, Serializable {
public void afterPhase(PhaseEvent event);
public void beforePhase(PhaseEvent event);
public PhaseId getPhaseId();
}
