Class AjaxHandler

All Implemented Interfaces:
AttachedObjectHandler, BehaviorHolderAttachedObjectHandler, FaceletHandler

public final class AjaxHandler extends TagHandlerImpl implements BehaviorHolderAttachedObjectHandler

Enable one or more components in the view to perform Ajax operations. This tag handler must create an instance of AjaxBehavior using the tag attribute values.

The events attribute for this tag that can be a ValueExpression must be evaluated at tag execution time since the event name is used in the process of Behavior creation.
If this tag is nested within a single ClientBehaviorHolder component:

Check for the existence of the Ajax resource by calling UIViewRoot.getComponentResources(). If the Ajax resource does not exist, create a UIOutput component instance and set the renderer type to jakarta.faces.resource.Script. Set the the following attributes in the component's attribute Map: library with the value "jakarta.faces" and name with the value "faces.js". Install the component resource using UIViewRoot.addComponentResource() and specifying head as the target argument.

If this tag has component children, add the AjaxBehavior to AjaxBehaviors by calling AjaxBehaviors.pushBehavior(jakarta.faces.context.FacesContext, jakarta.faces.component.behavior.AjaxBehavior, java.lang.String). As subsequent child components that implement the ClientBehaviorHolder interface are evaluated this AjaxBehavior instance must be added as a behavior to the component.

Version:
$Id: AjaxHandler.java 5369 2008-09-08 19:53:45Z rogerk $
  • Constructor Details

    • AjaxHandler

      public AjaxHandler(TagConfig config)
      Parameters:
      config -
  • Method Details

    • apply

      public void apply(FaceletContext ctx, UIComponent parent) throws IOException
      Description copied from interface: FaceletHandler

      Process changes on a particular UIComponent

      Specified by:
      apply in interface FaceletHandler
      Parameters:
      ctx - the current FaceletContext instance for this execution
      parent - the parent UIComponent to operate upon
      Throws:
      IOException - if unable to load relativePath
    • applyAttachedObject

      public void applyAttachedObject(FacesContext context, UIComponent parent)
      Description copied from interface: AttachedObjectHandler

      Take the argument parent and apply this attached object to it. The action taken varies with class that implements one of the subinterfaces of this interface.

      Specified by:
      applyAttachedObject in interface AttachedObjectHandler
      Parameters:
      context - The FacesContext for this request
      parent - The UIComponent to which this particular attached object must be applied.
    • getFor

      public String getFor()
      Description copied from interface: AttachedObjectHandler

      Return the value of the "for" attribute specified by the page author on the tag for this AttachedObjectHandler.

      Specified by:
      getFor in interface AttachedObjectHandler
      Returns:
      the value of the "for" attribute for this attached object
    • getEventName

      public String getEventName()
      Description copied from interface: BehaviorHolderAttachedObjectHandler

      Return the client event name to which this behavior applies.

      Specified by:
      getEventName in interface BehaviorHolderAttachedObjectHandler
      Returns:
      the client event name for this behavior