JBoss.orgCommunity Documentation

Chapter 4. Basic concepts

4.1. Sending an Ajax request
4.2. Partial tree processing
4.3. Partial view updates
4.4. Component overview

Read this chapter for the basic concepts of using RichFaces in conjunction with Ajax and JavaServer Faces.

Many of the tags in the r tag library are capable of sending Ajax requests from a JavaServer Faces (JSF) page.

  • The <a4j:commandButton> and <a4j:commandLink> tags are used to send an Ajax request on the click JavaScript event.
  • The <a4j:poll> tag is used to send an Ajax request periodically using a timer.
  • The <a4j:ajax> tag allows you to add Ajax functionality to standard JSF components and send Ajax request on a chosen JavaScript event, such as keyup or mouseover, for example.
  • Most components in the r tag library have built-in Ajax support. Refer to the RichFaces Component Reference for details on the use of each component.

Use the execute attribute to specify which parts of the JSF tree to process during an Ajax request. The execute attribute can point to an id identifier of a specific component to process. Components can also be identified through the use of Expression Language (EL).

Alternatively, the execute attribute accepts the following keywords:

@all
Every component is processed.
@none
No components are processed.
@this
The requesting component with the execute attribute is processed.
@form
The form that contains the requesting component is processed.
@region
The region that contains the requesting component is processed. Use the <a4j:region> component as a wrapper element to specify regions. Some components make use of additional keywords. These are detailed under the relevant component entry in the RichFaces Component Reference .

Use the render attribute to specify which components to render for an Ajax update. The render attribute can point to an id identifier of a specific component to update. Components can also be identified through the use of Expression Language (EL).

Alternatively, the render attribute accepts the following keywords:

@all
Every component is updated.
@none
No components are updated.
@this
The requesting component with the execute attribute is updated.
@form
The form that contains the requesting component is updated.
@region
The region that contains the requesting component is updated. Use the <a4j:region> component as a wrapper element to specify regions.

Some components make use of additional keywords. These are detailed under the relevant component entry in the RichFaces Component Reference .

Use the <a4j:outputPanel> component with the ajaxRendered="true" setting to always update a section irrespective of the requesting component’s render attribute. The <rich:message> and <rich:messages> components are based on the <a4j:outputPanel> component, and as such will also always be updated. To override this behavior, use the limitRender="true" setting on the requesting component.

The RichFaces framework is made up of two tag libraries: the rich and a4j libraries. The a4j tag library includes both the low-level ajax functionality, while the rich tag library includes the high-level components for building web applications. This allows developers to make use of custom Ajax behavior with existing componentsas well as leverage the many ready-made, self-contained components. These components don’t require additional configuration in order to send requests or update.

For details on the use of the various components, refer to RichFaces Component Reference .