Java Reference
In-Depth Information
The execute attribute can also be a keyword, such as @all , @none , @this , or
@form . The default value is @this , which refers to the component within which the
f:ajax tag is nested.
The following code specifies that the h:inputText component with the id value of
userNo should be executed when the button is clicked:
Click here to view code image
<h:inputText id="userNo"
title="Type a number from 0 to 10:"
value="#{userNumberBean.userNumber}">
...
</h:inputText>
<h:commandButton id="submit" value="Submit">
<f:ajax event="click" execute="userNo" />
</h:commandButton>
Using the immediate Attribute
The immediate attribute indicates whether user inputs are to be processed early in the
application lifecycle or later. If the attribute is set to true , events generated from this
component are broadcast during the Apply Request Values phase. Otherwise, the events
will be broadcast during the Invoke Applications phase.
If not defined, the default value of this attribute is false .
Using the listener Attribute
The listener attribute refers to a method expression that is executed on the server
side in response to an Ajax action on the client. The listener's
javax.faces.event.AjaxBehaviorListener.processAjaxBehavior
method is called once during the Invoke Application phase of the lifecycle. In the follow-
ing example, a listener attribute is defined by an f:ajax tag, which refers to a meth-
od from the bean.
<f:ajax listener="#{mybean.someaction}" render="somecomponent" />
The following code represents the someaction method in mybean .
Click here to view code image
public void someaction(AjaxBehaviorEvent event) {
dosomething;
}
Search WWH ::




Custom Search