JBoss.orgCommunity Documentation

Chapter 3. RichFaces overview

3.1. Full technical requirements
3.1.1. Server requirements
3.1.2. Client requirements
3.1.3. Development requirements
3.2. Architecture
3.2.1. Ajax Action Components
3.2.2. Ajax Containers
3.2.3. Ajax Output
3.2.4. Skins and theming
3.2.5. RichFaces Ajax Extensions
3.3. Technologies
3.4. Differences between JSF and RichFaces mechanisms
3.5. Restrictions

Read this chapter for technical details on the RichFaces framework.

RichFaces has been developed with an open architecture to be compatible with a wide variety of environments.

The important elements of the RichFaces framework are as follows:

  • Ajax Action Components
  • Ajax Containers
  • Ajax Output
  • Skins and Theming
  • RichFaces Ajax Extensions

Read this section for details on each element.

RichFaces 4 features full JSF 2 integration and uses standard web application technologies such as JavaScript, XML (Extensible Markup Language), and XHTML (Extensible Hypertext Markup Language).

JavaServer Faces 2 evaluates Ajax options, such as execute and render, while rendering a page. This allows any parameters to be sent directly from the client side.

RichFaces evaluates the options when the current request is sent. This increases both the security of the data and the convenience for evaluating parameters.

For example, binding Ajax options to Java Bean properties in RichFaces allows you to evaluate the options dynamically for the current request, such as defining additional zones to render. Parameters changed manually on the client side will not influence the request processing. With JSF 2, the options have evaluated during the previous page rendering would need to be used.

The following restrictions apply to applications implementing the RichFaces framework:

  • As with most Ajax frameworks, you should not attempt to append or delete elements on a page using RichFaces Ajax, but should instead replace them. As such, elements that are rendered conditionally should not be targeted in the render attributes for Ajax controls. For successful updates, an element with the same identifier as in the response must exist on the page. If it is necessary to append code to a page, include a placeholder for it (an empty element).
  • JSF 2 does not allow resources such as JavaScript or Cascading Style Sheets (CSS) to be added if the element requiring the resource is not initially present in the JSF tree. As such, components added to the tree via Ajax must have any required resources already loaded. In RichFaces, any components added to the JSF tree should have components with corresponding resources included on the main page initially. To facilitate this, components can use the rendered="false" setting to not be rendered on the page.
  • JSF does render resource links (stylesheets, scripts) in order of occurence, thus if you add <h:outputStylesheet> to the <h:head> section, JSF will render it before the RichFaces resource links (dependencies of RichFaces components). To be able to overwrite RichFaces stylesheets and re-use RichFaces JavaScript implementation, you need to render <h:outputStylesheet target="head"> to the <h:body> section (safe solution is to place it on the end of the section; however to keep readability, you can use start of the section).
  • Switching RichFaces skins via Ajax during runtime should be avoided, as this requires all the stylesheets to be reloaded.