<h:commandButton id="submit" value="Submit">
<f:ajax execute="userNo" render="result" />
</h:commandButton>
<h:outputText id="result" value="#{userNumberBean.response}" />
Java Platform, Enterprise Edition (Java EE) 8 The Java EE Tutorial |
Previous | Next | Contents |
After the application sends an Ajax request, it is processed on the
server side, and a response is sent back to the client. As described
earlier, Ajax allows for partial updating of web pages. To enable such
partial updating, JavaServer Faces technology allows for partial
processing of the view. The handling of the response is defined by the
render
attribute of the f:ajax
tag.
Similar to the execute
attribute, the render
attribute defines which
sections of the page will be updated. The value of a render
attribute
can be one or more component id
values, one of the keywords @this
,
@all
, @none
, or @form
, or an EL expression. In the following
example, the render
attribute identifies an output component to be
displayed when the button component is clicked (the default event for a
command button):
<h:commandButton id="submit" value="Submit">
<f:ajax execute="userNo" render="result" />
</h:commandButton>
<h:outputText id="result" value="#{userNumberBean.response}" />
Note: Behind the scenes, once again the |
Previous | Next | Contents |