- All Implemented Interfaces:
AttachedObjectHandler,BehaviorHolderAttachedObjectHandler,FaceletHandler
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.
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.ClientBehaviorHolder component:
- 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 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 $
-
Field Summary
Fields inherited from class jakarta.faces.view.facelets.TagHandler
nextHandler, tag, tagId -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidapply(FaceletContext ctx, UIComponent parent) Process changes on a particular UIComponentvoidapplyAttachedObject(FacesContext context, UIComponent parent) Take the argumentparentand apply this attached object to it.Return the client event name to which this behavior applies.getFor()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, findNextByTypeMethods inherited from class jakarta.faces.view.facelets.TagHandler
getAttribute, getRequiredAttribute, toString
-
Constructor Details
-
AjaxHandler
- Parameters:
config-
-
-
Method Details
-
apply
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
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
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
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
-