type=page
status=published
title=Receiving an Ajax Response
next=jsf-ajax008.html
prev=jsf-ajax006.html
~~~~~~
Receiving an Ajax Response
==========================

[[GKDBR]]

[[receiving-an-ajax-response]]
Receiving an Ajax Response
--------------------------

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):

[source,oac_no_warn]
----
<h:commandButton id="submit" value="Submit">
    <f:ajax execute="userNo" render="result" />
</h:commandButton>
<h:outputText id="result" value="#{userNumberBean.response}" />
----


[width="100%",cols="100%",]
|=======================================================================
a|
*Note*:

Behind the scenes, once again the `jsf.ajax.request()` method handles
the response. It registers a response-handling callback when the
original request is created. When the response is sent back to the
client, the callback is invoked. This callback automatically updates the
client-side DOM to reflect the rendered response.

|=======================================================================
