tutorial.jsf.ajax
Class AjaxListener

java.lang.Object
  extended by tutorial.jsf.ajax.AjaxListener
All Implemented Interfaces:
java.io.Serializable, java.util.EventListener, javax.faces.event.PhaseListener

public class AjaxListener
extends java.lang.Object
implements javax.faces.event.PhaseListener

Title: AjaxComponent

Author:
Matt Tyson

A simple phase listener to filter Ajax requests. Examines request in RESTORE_VIEW afterphase. Avoids any uneccessary lifecycle processing.

See Also:
Serialized Form

Constructor Summary
AjaxListener()
          default empty constructor
 
Method Summary
 void afterPhase(javax.faces.event.PhaseEvent event)
          Handling any potential Ajax component requests after the Restore View phase makes the restored view available to us.
 void beforePhase(javax.faces.event.PhaseEvent arg0)
          Here we are just using the beforePhase to do some logging.
 javax.faces.event.PhaseId getPhaseId()
           
protected  void handleAjaxRequest(javax.faces.context.FacesContext context, java.lang.String ajaxClientId)
          Deal with the ajax request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AjaxListener

public AjaxListener()
default empty constructor

Method Detail

afterPhase

public void afterPhase(javax.faces.event.PhaseEvent event)
Handling any potential Ajax component requests after the Restore View phase makes the restored view available to us. Therefore, we can get the component (which made the request) from the view, and let it respond to the request.

Specified by:
afterPhase in interface javax.faces.event.PhaseListener

handleAjaxRequest

protected void handleAjaxRequest(javax.faces.context.FacesContext context,
                                 java.lang.String ajaxClientId)
Deal with the ajax request.

Parameters:
context -
ajaxClientId -

beforePhase

public void beforePhase(javax.faces.event.PhaseEvent arg0)
Here we are just using the beforePhase to do some logging.

Specified by:
beforePhase in interface javax.faces.event.PhaseListener

getPhaseId

public javax.faces.event.PhaseId getPhaseId()
Specified by:
getPhaseId in interface javax.faces.event.PhaseListener


Copyright © 2008. All Rights Reserved.