Jump to content

RichFaces

From Alfawiki
RichFaces
Company typeOpen source software
IndustrySoftware development, Java web frameworks
PredecessorAjax4jsf
Founded2006
FounderAlexander Smirnov
DefunctJune 2016 (2016-06)
FateDiscontinued
Area served
Worldwide
Key people
Alexander Smirnov, Michal Petrov
ProductsAjax-enabled JSF component library
OwnerJBoss (Red Hat)
Websitedeveloper.jboss.org/en/richfaces

RichFaces was an open source library of Ajax-enabled components designed for JavaServer Faces (JSF) and maintained by JBoss. It simplified the incorporation of Ajax functionality into enterprise-level applications and was officially discontinued in June 2016.

In addition to a typical JSF component collection, RichFaces provided:

  • Customizable application appearance through skinning capabilities
  • A Component Development Kit (CDK) for creating JSF components
  • A Dynamic Resource Framework
  • Ajax controls applicable at both the page and individual component levels

History

The origins of RichFaces trace back to the Ajax4jsf framework, initially created by Alexander Smirnov. After joining Exadel in 2005, Smirnov continued its development, culminating in the 2006 launch of Ajax4jsf. That same year, Exadel divided its Visual Component Platform (VCP) into two projects: Ajax4jsf and RichFaces. While RichFaces delivered ready-to-use "component-centric" Ajax components, Ajax4jsf focused on enabling Ajax control across entire pages. Ajax4jsf was released as an open-source project on java.net, whereas RichFaces was positioned as a commercial JSF component suite.

In March 2007, JBoss, part of Red Hat, collaborated with Exadel to rebrand Ajax4jsf and RichFaces as "JBoss Ajax4jsf" and "JBoss RichFaces," respectively, transitioning RichFaces to an open-source and freely available product. By September 2007, both initiatives were unified under the RichFaces name to enhance development efficiency and address compatibility challenges between versions.

On February 12, 2016, Michal Petrov announced that RichFaces would be retired by June 2016.

Framework

This framework serves as a component library that integrates Ajax functionality into existing pages without requiring developers to write JavaScript or substitute components with new Ajax-specific widgets. RichFaces enables page-wide Ajax support, allowing developers to define triggering events for Ajax calls and designate which sections of a page should synchronize with the JSF Component Tree following server-side updates.

By employing JSF tags, developers can specify which portions of a JSF page are refreshed via Ajax requests and select from various methods to initiate these requests. The structure of the JSF page remains unchanged compared to standard pages, minimizing the need for JavaScript code while preserving server-managed page state effectively.

RichFaces architecture

The architecture of RichFaces comprises an Ajax filter, action components, containers, and a client-side JavaScript engine:

  • Ajax filter – Configured within the web.xml file, it processes different request types to enable RichFaces’ features.
  • Ajax action components – Elements such as AjaxCommandButton, AjaxCommandLink, AjaxPoll, and AjaxSupport that dispatch Ajax requests from the client side.
  • Ajax containers – The AjaxContainer interface specifies page segments decoded during Ajax interactions; implemented by classes like AjaxViewRoot and AjaxRegion.
  • JavaScript engine – Operates on the client side to refresh designated areas of a JSF page based on Ajax responses and offers an API that removes the necessity for custom JavaScript coding.

Skinnability

The skinnability aspect of RichFaces defines standardized interface styles using XCSS technology to provide flexibility in appearance. It includes several built-in skins such as DEFAULT, plain, emeraldTown, blueSky, wine, japanCherry, ruby, classic, deepMarine, Laguna (3.2.1), GlassX (3.2.2), and DarkX (3.2.2).

Skin attributes (for example, generalBackgroundColor or generalLinkColor) reside in skinname.skin.properties files. Each component is associated with an XCSS file linking CSS selectors to these skin properties. Additionally, RichFaces supports theming for standard HTML controls. Users can develop custom skins through the Plug-n-Skin feature—a Maven archetype that generates scaffolding for new skins.

Basic JSF page featuring RichFaces calendar component

<syntaxhighlight lang="xml"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999"

     xmlns:ui="http://java.sun.com/jsf/facelets"
     xmlns:h="http://java.sun.com/jsf/html"
     xmlns:f="http://java.sun.com/jsf/core"
     xmlns:a4j="http://richfaces.org/a4j"
     xmlns:rich="http://richfaces.org/rich">
 <ui:composition template="/templates/component-sample.xhtml">
   <a4j:outputPanel id="calendar" layout="block">
     <rich:calendar value="#{calendarBean.selectedDate}"
       locale="#{calendarBean.locale}"
       popup="#{calendarBean.popup}"
       showApplyButton="#{calendarBean.showApply}"
       cellWidth="24px" cellHeight="22px" style="width:200px"/>
   </a4j:outputPanel>
 </ui:composition>

</html> </syntaxhighlight>

The output generated by this markup is as follows:


Related topics

Useful links