PhotoAlbum Application Download Support Developer Guide
Skins:
Resources/Beans Handling
Ajax Miscellaneous
Usage
Tag Information

Ajax region is a key ajax component. It limits the part of the component tree to be processed on the server side when ajax request comes. Processing means invocation during Decode, Validation and Model Update phase. Most common reasons to use a region are:

  • avoiding the aborting of the JSF lifecycle processing during the validation of other form input unnecessary for given ajax request;
  • defining the different strategies when events will be delivered (immediate="true/false")
  • showing an individual indicator of an ajax status
  • increasing the performance of the rendering processing (selfRendered="true/false", renderRegionOnly="true/false")

The following two examples show the situation when a validation error does not allow to process an ajax input. Type the name. The outputText component should reappear after you. However, in the first case, this activity will be aborted because of the other field with required="true". You will see only the error message while the "Job" field is empty.

AjaxRegion Demo
Name
Job
Name
Job
Typed Name:


View Source

If no one region is defined explicitly on the page, the whole view plays the role of a region. Regions might be nested. When the ajax request is invoked by the ajax component, the closest to this component region becomes an actual.

Ajax region does not define what the area(s) on the page should be refreshed when the ajax response is complete. You need to use reRender attribute of the ajax components or use a4j:outputPanel ajaxRendered="true" for this purpose.

Ajax region might limit the set of areas to be re-rendered if regionRenderOnly="true". If this attribute is set, only the marked area(s) inside the given region will be included in the list for re-render. The marked area(s) outside of the region will be omitted.

The area(s) marked for update might be re-rendered directly from the component tree rather than involving jsp (xhtml) page processing if selfRendered attribute is set to true. This might bust the performance to decrease time spending on Render Response phase. However, you need to be aware that the artifact that are not included in the component tree will disappear from your page after the page is updated.
Most known component that is not stored in the component tree is f:verbatim. It is often used to wrap non-jsf content such as pure html tags in JSF 1.1. However, even f:verbatim is not required, the pure html tags are not stored in the component tree and will be revoked from the update area(s) if selfRendered="true".

The following example shows the typical situation when the content unexpectedly disappear during the partial page update when selfRendered="true". The right part of the example works fine, because the text is produced by the standard h:outputText component that is stored in the component tree. Both forms are wrapped with a4j:region selfRendered="true"

AjaxRegion Demo
Name

This text will disappear during the partial update of this panel. The text appears again only after the whole page refresh or a partial update from the region with selfRendered="false" (default value).
Name

The text of the similar panel will not disappear because it is printed with h:outputText
Typed Name:


View Source
RichFaces Wiki RichFaces Project Site