Class AjaxHandler
- java.lang.Object
-
- jakarta.faces.view.facelets.TagHandler
-
- com.sun.faces.facelets.tag.TagHandlerImpl
-
- com.sun.faces.facelets.tag.faces.core.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
AjaxBehaviorusing the tag attribute values.TheIf this tag is nested within a singleeventsattribute for this tag that can be aValueExpressionmust be evaluated at tag execution time since the event name is used in the process ofBehaviorcreation.ClientBehaviorHoldercomponent:- If the
eventsattribute value is not specified, obtain the default event name by callingClientBehaviorHolder.getDefaultEventName(). If that returnsnullthrow anexception. - If the
eventsattribute value is specified, ensure it that it exists in theCollectionreturned from a call toClientBehaviorHolder.getEventNames()and throw anexceptionif it doesn't exist. - Add the
AjaxBehaviorinstance to theClientBehaviorHoldercomponent by callingClientBehaviorHolder.addClientBehavior(java.lang.String, jakarta.faces.component.behavior.ClientBehavior)passingeventand theAjaxBehaviorinstance.
Check for the existence of the Ajax resource by calling
UIViewRoot.getComponentResources(). If the Ajax resource does not exist, create aUIOutputcomponent instance and set the renderer type tojakarta.faces.resource.Script. Set the the following attributes in the component's attributeMap:librarywith the value "jakarta.faces" andnamewith the value "faces.js". Install the component resource usingUIViewRoot.addComponentResource()and specifyingheadas thetargetargument.If this tag has component children, add the
AjaxBehaviortoAjaxBehaviorsby callingAjaxBehaviors.pushBehavior(jakarta.faces.context.FacesContext, jakarta.faces.component.behavior.AjaxBehavior, java.lang.String). As subsequent child components that implement theClientBehaviorHolderinterface are evaluated thisAjaxBehaviorinstance must be added as a behavior to the component.- Version:
- $Id: AjaxHandler.java 5369 2008-09-08 19:53:45Z rogerk $
-
-
Field Summary
-
Fields inherited from class jakarta.faces.view.facelets.TagHandler
nextHandler, tag, tagId
-
-
Constructor Summary
Constructors Constructor Description AjaxHandler(TagConfig config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapply(FaceletContext ctx, UIComponent parent)Process changes on a particular UIComponentvoidapplyAttachedObject(FacesContext context, UIComponent parent)Take the argumentparentand apply this attached object to it.StringgetEventName()Return the client event name to which this behavior applies.StringgetFor()Return the value of the "for" attribute specified by the page author on the tag for thisAttachedObjectHandler.-
Methods inherited from class com.sun.faces.facelets.tag.TagHandlerImpl
findNextByType, findNextByType
-
Methods inherited from class jakarta.faces.view.facelets.TagHandler
getAttribute, getRequiredAttribute, toString
-
-
-
-
Constructor Detail
-
AjaxHandler
public AjaxHandler(TagConfig config)
- Parameters:
config-
-
-
Method Detail
-
apply
public void apply(FaceletContext ctx, UIComponent parent) throws IOException
Description copied from interface:FaceletHandlerProcess changes on a particular UIComponent
- Specified by:
applyin interfaceFaceletHandler- Parameters:
ctx- the current FaceletContext instance for this executionparent- the parent UIComponent to operate upon- Throws:
IOException- if unable to loadrelativePath
-
applyAttachedObject
public void applyAttachedObject(FacesContext context, UIComponent parent)
Description copied from interface:AttachedObjectHandlerTake the argument
parentand apply this attached object to it. The action taken varies with class that implements one of the subinterfaces of this interface.- Specified by:
applyAttachedObjectin interfaceAttachedObjectHandler- Parameters:
context- TheFacesContextfor this requestparent- TheUIComponentto which this particular attached object must be applied.
-
getFor
public String getFor()
Description copied from interface:AttachedObjectHandlerReturn the value of the "for" attribute specified by the page author on the tag for this
AttachedObjectHandler.- Specified by:
getForin interfaceAttachedObjectHandler- Returns:
- the value of the "for" attribute for this attached object
-
getEventName
public String getEventName()
Description copied from interface:BehaviorHolderAttachedObjectHandlerReturn the client event name to which this behavior applies.
- Specified by:
getEventNamein interfaceBehaviorHolderAttachedObjectHandler- Returns:
- the client event name for this behavior
-
-