JBoss.orgCommunity Documentation
Some concepts covered in this chapter may refer to the previous version of Richfaces, version 3.3.3. This chapter is scheduled for review to ensure all information is up to date.
Read this chapter for the basic concepts of using RichFaces in conjunction with Ajax and JavaServer Faces.
Many of the tags in the a4j
and rich
tag libraries are capable of sending Ajax requests from a JavaServer Faces (JSF) page. RichFaces tags hide the usual JavaScript activities that are required for an XMHTTPRequest object building and an Ajax request sending. Additionally the tags can determine which components of a JSF page are to be re-rendered as a result of the Ajax response; refer to Section 4.2.1, “Partial page updates” for details.
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 rich
tag library have built-in Ajax support. Refer to the RichFaces Component Reference for details on the use of each component.
Updates are made only to those regions specified using the execute
. If no specific regions are declared, the whole page is updated when an Ajax response is received.
Specific regions of a page can be defined through the use of container components such as <a4j:region>
. These regions can then be specified with their id
identifiers in the render
attribute of a component so that when the component sends an Ajax request, only the specified regions are updated. In this way you can control which part of the JSF View is decoded on the server side when the Ajax request is sent. Multiple regions can be defined and sent, and regions can be nested inside other regions. Controls and components from third-party libraries contained in these regions are also updated.
Additionally, regions can be wrapped with the <a4j:outputPanel ajaxRendered="true">
tag. This causes all contents of the region to be updated on every Ajax response, even if not explicitly listed in the requesting component's render
attribute.
Setting the limitRender
attribute to true
will cause only those regions listed in the requesting component's render
attribute to be updated. This overrides any regions with the <a4j:outputPanel ajaxRendered="true">
tag.
Refer to the RichFaces Component Reference for further details on the common Ajax attributes used for partial page updates.
The RichFaces framework is made up of two tag libraries: the a4j
library and the rich
library. The a4j
tag library represents Ajax4jsf, which provides page-level Ajax support with core Ajax components. This allows developers to make use of custom Ajax behavior with existing components. The rich
tag library provides Ajax support at the component level instead, and includes 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.