Max Katz heads Developer Relations for, a cloud-based mobile app platform. He loves trying out new and cool REST APIs in mobile apps. Max is the author of two books “Practical RichFaces” (Apress 2008, 2011), and is a frequent speaker at developer conferences. You can find out what Max is up to on his blog: and Twitter: @maxkatz. Max is a DZone MVB and is not an employee of DZone and has posted 82 posts at DZone. You can read more from them at their website. View Full User Profile

An Introduction To JBoss RichFaces

  • submit to reddit

This tutorial article will give a very quick introduction to JBoss RichFaces. Instead of just listing features, we are going to briefly define RichFaces and then dive right into an actual step-by-step example. In this example, we are going to go beyond the standard “Hello World” type of example. We will come back to this in just a moment.

JBoss RichFaces

If you know what RichFaces is already, then you can probably skip this section. For those of you who don't, here is what you need to know (the most important parts). JBoss RichFaces is a rich component library for JSF. RichFaces doesn't replace standard JSF, so you use RichFaces with either the Mojara JSF (Sun RI) implementation or the MyFaces implementation. RichFaces simply provides ready-to-use Ajax components to enable building Ajax-based applications. Another way to look at it is as just lots of extra JSF components beyond what the standard JSF provides. These components include all the necessary JavaScript coding, so you almost never have to work with JavaScript directly.

OK, this is the only place where I'm probably going to create some confusion, but I'm allowed to do it just once. RichFaces is not just a set of plug-ins, but actually a framework. One of its major features is its rich components. The components are divided into tag libraries. In addition, RichFaces provides a skinability (themes) features along with the Ajax4jsf CDK (Component Development Kit). For this article, I'm only mentioning CDK, so you are aware that it exists.

Two Tag Libraries

While the product is called RichFaces, it still has two different tag libraries. One tag library is called a4j: and the other is called rich:. The a4j: tag library provides page-level AJAX support. It basically provides foundation-like controls where you decide how to send a request, what to send to the server, and what to update. This approach gives you a lot of power and flexibility. The rich: tag library provides component-level AJAX support. Components from this library provide all their functionality out-of-the-box. In other words, you don’t need to decide how to send a request and what to update.


Another major feature is skinability (or themes). Any number of skins (defined via a property file) can be created with different color schemes. When a particular skin is set, component renderers will refer to that skin and generate colors, images, styles, and stylesheets based on that skin. What this means is that you can easily change the look and feel of the whole application by simply switching to a different skin. I have dedicated a complete section to this topic.

We're done. That's all you need to know for now.

Beyond “Hello World”

I'm pretty sure you are somewhat tired of “Hello World” examples. While they are very useful (at the beginning), they are not very practical in the real world. So, this time, let's go beyond “Hello World.” In this example, we will display a list of users in a table. Each row will have an “Edit” button. When this button is clicked, the application will open up a modal panel where that selected user can be edited. When changes are saved, only that particular row in the table will be updated, not the entire table.

Let's get started. We will start with the required software. You might already have the required software, so it's really your choice if you want to use your existing setup or continue with my setup. Our final application will look like this:

Article Resources: 
Published at DZone with permission of Max Katz, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)


Max Katz replied on Mon, 2008/10/27 - 12:35pm in response to: Christian Lehmann

Sorry, just one sortBy attribute. I tried it with RichFaces 3.2.2, it worked for me. What version are you running?

Greg Fasnacht replied on Mon, 2008/11/17 - 10:32am

I'm attempting to set up your project in Eclipse 3.4 (Ganymede). I installed the JBoss Tools plugin (Stable Release 2.1.2 GA) then tried to create a new project (JBoss Tools Web->JSF->JSF Project). I named the project and then chose the "JSF 2.0" JSF environment (other choices were" JSF Reference Implementation", "JSF 2.0 with Facelets" and "MyFaces 1.1.4"). I chose the template "JSFKickStartWithoutLibs" then clicked on "Next" which brought me to the runtime setup window. I chose servlet version 2.5, then tried to create a new Runtime (since the associated text box was empty). Clicking on the "New" button had no effect. Similarly, the Target Server choice list is empty, and the "New" button again has no effect.  Do you have any ideas as to what the problem might be?

Max Katz replied on Mon, 2008/11/17 - 12:42pm in response to: Greg Fasnacht

If you look under Installation section, JBoss Tools 2.1.2 only works with Eclipse 3.3. You need to use JBoss Tools 3.0 with Eclipse 3.4 . You also need to install the custom template (link available in this tutorial) in order to get JSF 1.2, Facelets, RichFaces enviroment available for this tutorial. Let me know if you have other questions.

Greg Fasnacht replied on Mon, 2008/11/17 - 2:12pm in response to: Max Katz

So if I'm understanding you correctly, I can't use the Eclipse Plugin for JBoss Tools, since the plugin shows the latest stable release as being 2.1.2 GA. Am I correct? BTW, thank you for your quick response.

Max Katz replied on Mon, 2008/11/17 - 2:41pm in response to: Greg Fasnacht

It's not that you can't use, you can use the beta version. This is how the versioning works:

Eclipse 3.3 --> JBoss Tools 2.1.2
Eclipse 3.4 --> JBoss Tools 3.0.0 beta 1

Robert Wojcikiewicz replied on Wed, 2008/11/19 - 10:39am

Hi Max,

Firstly, your tutorial is realy useful - one of the best I found. Everything would be ok but I hava a small problem. When I click Edit and fill modal window's fields after clicking Save, the edited row table doesn't display my changes. Why? In faces-config.xml I change value of <managed-bean-scope> tag on: session. Before that I had an exception after clicking save button.

I hope you will help to solve my problem.

Best regards,



rui chagas replied on Wed, 2008/11/19 - 11:34am

I also have an exception when i click "save" button. The "save" method can't be found. can you help me?

Max Katz replied on Wed, 2008/11/19 - 11:37am

Do you have this tag on the page:

<a4j:keepAlive beanName="userBean"/>


rui chagas replied on Wed, 2008/11/19 - 12:09pm in response to: Max Katz

yes i do, right before  <rich:modalPanel id="anunedit"> .  When i click the "save" button the tomcat gets an exception that says "can't find "save" method..


Max Katz replied on Wed, 2008/11/19 - 12:34pm in response to: rui chagas

Please post the exception, JSF page and managed bean code.

Robert Wojcikiewicz replied on Thu, 2008/11/20 - 3:22am

Hi Max,

   I add tag <a4j:keepAlive beanName="userBean"/> after the line <a4j:commandButton value="Edit"...

Now when I click Save app doesn't throw an exception but new value form fields is not saved.

There is one thing. Whitout tag <a4j:keepAlive beanName="userBean"/> and  changing bean scope from request to session, changes were present but after when I refreshed web page.

Can you help or suggest some solution?



Max Katz replied on Thu, 2008/11/20 - 11:29am

Make sure you have set ajaxKeys attribute on rich:dataTable. ajaxKeys points to rows to be re rendered.

Brendan Farragher replied on Fri, 2008/12/05 - 11:41am

Hi. What version of JBoss AS are you using? I am using JBoss 4.2, and I cannot get the @PostConstruct method to fire on a simple managed bean. There are no EJBs involved. Just a simple pojo, configured as a managed bean, with one annotated method that has @PostConstruct. I have tried with both request and session scoped beans, but the message that I print to the log never shows up.

 Thanks so much.

Max Katz replied on Fri, 2008/12/05 - 12:06pm in response to: Brendan Farragher


Hi. What version of JBoss AS are you using? I am using JBoss 4.2, and I cannot get the @PostConstruct method to fire on a simple managed bean. There are no EJBs involved. Just a simple pojo, configured as a managed bean, with one annotated method that has @PostConstruct. I have tried with both request and session scoped beans, but the message that I print to the log never shows up.

 Thanks so much.


 I used Tomcat 6.

Juliane Gambke replied on Mon, 2008/12/08 - 12:08pm


 Thanks for the thorough introduction which gave me a good start. I'm expanding the modal panel functionality to behave like a wizard. That means when clicking on the edit button the first page of the modal panel opens, there I can either close the panel or proceed to the next page within the modal panel by clicking the respective button. Now when i close the panel and click another items edit button the panels last page gets displayed instead of the first page. Also the lasts pages values are not refreshed. I've been searching for a solution for several hours now. Do you have any hint for me?

 Thank your very much!

Max Katz replied on Mon, 2008/12/08 - 1:13pm

There is some info here on how to do that: . There is also an example in my book, Practical RichFaces. I have a few free PDF copies left, send me an email if you want one (reference this post).

Juliane Gambke replied on Tue, 2008/12/09 - 5:57am

Thanks for the quick reply!

 I found another interesting post solving the modal panel navigation/ refresh problem described in my first post. In case anyone is interested:


Augusto Sellhorn replied on Tue, 2008/12/16 - 11:34am

I think I followed all the steps correctly, and I downloaded the latest of everything but I'm getting;

 "Core library location for version JSF 1.2, Facelets, RichFaces is not correct."

On the "create JSF project" dialog. Don't know how to get more information on this, anybody have any ideas what I'm doing wrong?

 I got the JBoss tools v 3.0.0Beta1 with Eclipse 3.4.1

Augusto Sellhorn replied on Tue, 2008/12/16 - 3:12pm

Whoops, never mind.

 I have one of these unzipping programs that won't zip all things out by default if you have an item highlighted, so it seems I missed the lib/ folder!

Max Katz replied on Tue, 2008/12/16 - 6:11pm in response to: Augusto Sellhorn


Whoops, never mind.

 I have one of these unzipping programs that won't zip all things out by default if you have an item highlighted, so it seems I missed the lib/ folder!


Glad it's working. 

Dragan Mijailovic replied on Thu, 2009/01/22 - 8:11am

In my Intranet application I use RichFaces with RestFaces and I use keepAlive tag for my backing beans. All it is ok, but I am afraid of memory overflow because of:

KeepAlive - serializes and stores request beans IN SESSION and restores it after request. ( )

I saw that You used keepAlive tag in Your example. What do You think?

Best regards


Max Katz replied on Thu, 2009/01/22 - 11:31am

That's the intended behavior. a4j:keepAlive tag is used to keep objects alive for longer than request but less than session (basically a very simple idea of a conversation, like in Seam). The bean pointed to by a4j:keepAlive tag is added to the UI component tree and is saved with the tree (either in session or client, depending on javax.faces.STATE_SAVING_METHOD param). When the UI tree is restored, the bean placed back in request scope with all its values. Hope this helps.

Now, I'm not sure about memory overflow - are you talking about a memory leak?

Dragan Mijailovic replied on Fri, 2009/01/23 - 2:31am

Thanks a lot. Yes, I am talking about a memory leak.

But,  there is timeout for a conversation in Seam. Is there timeout for "keepAlive objects"? When does JSF(RichFaces) remove old "keepAlive objects"? If it is the answer: when session timeout happens, I think that is not good for memory resources. It is very important.



Max Katz replied on Fri, 2009/01/23 - 11:32am

There is currently no option to time out keepAlive objects. You can try do to it programmatically, it's an attribute of UIViewRoot. Seam converstations would be a better solution.

marius batrinu replied on Thu, 2009/01/29 - 7:31am

hi Max,

 What about the delete part of your tutorial? Using this example:

it seems that in order to delete a row we need to add rowKeyVar="row"to the databatable and on the delete button

<f:setPropertyActionListener value="#{row}" target="#{dataTableScrollerBean.currentRow}" />

 My question is what type should currentRow be in the backing bean? Can you give us a quick example on how to delete a row.


Max Katz replied on Thu, 2009/01/29 - 11:27am

currentRow can be an Integer (or small int). It is the row number in the model you want to delete. I'll post something on my blog on how to delete from a table (

marius batrinu replied on Fri, 2009/01/30 - 11:02am in response to: Max Katz

Thanks Max,

 I managed to fid the solution myself. Changes:

 on delete button/link:

<a4j:commandLink ajaxSingle="true" id="deletelink" oncomplete="#{rich:component('deletePanel')}.show()">
<f:setPropertyActionListener value="#{obj}" target="#{tableDataSource.selectedRow}"/>
  on 'Yes' button on confirmation modalPanel:

and finally backingBean.delete:


 works like a charm :-)

Any downsides to my solution?

Thanks :-)

Max Katz replied on Fri, 2009/01/30 - 12:21pm

Looks good!

Harshad Khasnis replied on Fri, 2009/02/06 - 7:57am

Hi Max,

I am using rich:modalPanel

I dont want that modal to be able to resized by user so I have used resizeble="false" attribute.

But it seems there is some bug and it still allows user to resize the modal panel.Can you please help?

here is my code

My development enviorment is 

JSF-RI 1.2, Facelets 1.1.15

Richfaces 3.3.0


<rich:modalPanel id="mp" resizeable="false" moveable="false" >
<f:facet name="header">
<h:outputLabel value="Move this" />
<h:outputText value="Try to resize" />



Asma Shah replied on Mon, 2009/02/16 - 8:48pm



I've followed the tutorial and on running the http://localhost:8080/richfaces-start/user.jsf page i only get a header saying Just Some Users. It does not load the users as it should be.

 I've tried few things we not success. Any leads you can provide?


Thanks a lot in advance

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.