Monday, December 1, 2008

My First RichFaces & Java Server Faces (JSF) Web Application


1 - Java SE Development Kit (JDK) 6 Update 11

Download Java SE 6

To install Java double click on the executable jdk-6u11-windows-i586.exe and follow the wizard instructions.

2 - Apache Tomcat 6.0.18

Tomcat is needed to deploy and run your RichFaces web application.

Download Tomcat 6.0.18

To install Tomcat, double click on the apache-tomcat-6.0.18.exe and follow the wizard instructions. You need to use the Java 6 home in the 'Java Virtual Machine' page.

3 - Eclipse Enterprise Edition 3.4 Ganymede

Download eclipse-jee-ganymede-SR1-win32

4 - Java Server Faces (JSF) libraries

Download JSF 1.2

5 - Java Standard Tag Library (JSTL) libraries

Download JSTL 1.2

6 - Facelets libraries

Download Facelets 1.1.14

7 - RichFaces libraries

Download RichFaces 3.2.2

8 - Apache Commons libraries

RichFaces needs the following apache commons jars:



Extract all the zip files to any directory (My extract directory C:\canjur\downloads).

Iam going to refer this directory (C:\canjur\downloads) as your DOWNLOADS_EXTRACT_HOME hereafter.


Step 1:

Go to <your eclipse home>\eclipse & Launch eclipse enterprise edition (eclipse.exe)

Step 2:

Create a workspace. Say C:\workspace-jee\richfaces-demo-1


Step 3:

In eclipse, go to Window->Preferences and choose Web->JavaServer Faces Tools->Libraries

Step 4:

You need to define the following new JSF libraries which is needed to create a JSF 1.2 with RichFaces web application
  • SUN_RI_1.2
  • JSTL
Lets do it one by one.


Click 'New ...' in the 'Libraries' page. Input the following :

Library Name: SUN-RI-1.2
Version Supported: v1_2

Click 'Add' under 'Library Jars'. The Browser for Jars/Zips pops up.

Go to your <DOWNLOADS_EXTRACT_HOME>\jsf-1_2\jsf-1.2-b20-FCS\lib (in my machine it is C:\canjur\jsf-1_2\jsf-1.2-b20-FCS\lib).

Select jsf-api.jar & jsf-impl.jar and click 'Open'.

Check 'Is JSF Implementation' in the Create JSF Library popup and click 'Finish'.


Repeat the same steps listed under SUN-RI-1.2 to add the JSTL library.

Note: Do not Check the 'Is JSF Implementation' for JSTL.

Library Name : JSTL
Version Supported : v1_2

Jar Name(s) : jstl-api-1.2.jar


Repeat the same steps listed under SUN-RI-1.2 to add the FACELETS library.

Note: Do not Check the 'Is JSF Implementation' for FACELETS.

Library Name : FACELETS
Version Supported : v1_2

Jar Location : <DOWNLOADS_EXTRACT_HOME>\facelets-1.1.14\facelets-1.1.14
Jar Name(s) : jsf-facelets.jar


Repeat the same steps listed under SUN-RI-1.2 to add the RICHFACES library.

Note: Do not Check the 'Is JSF Implementation' for RICHFACES.

Library Name : RICHFACES
Version Supported : v1_2

Jar Location :

Jar Name(s) :


Repeat the same steps listed under SUN-RI-1.2 to add the COMMONS library.

Note: Do not Check the 'Is JSF Implementation' for COMMONS.

Library Name : COMMONS
Version Supported : v1_2

Jar Location :
<DOWNLOADS_EXTRACT_HOME> (for commons-beanutils-1.7.0.jar)

Jar Name(s) :

Finally, Click OK button in the Preferences->Web->JavaServer Faces Tools popup.

You are ready to create a RichFaces web application. Lets rock !


Step 5:

Create a new Dynamic Web Project in eclipse.

Click File->New->Dynamic Web Project

Project Name : RichFaces
Target Runtime : (Don't worry about it now. We will define it later.)
Dynamic Web Module Version : 2.5
Configuration : JavaServer Faces v1.2 Project

Click Next.
Click Next.

  1. Choose SUN_RI_1.2 under JSF Libraries:
  2. Add all the Component Libraries to Deploy (click >>)
  3. Remove /faces/* from URL Mapping Patterns and add *.jsf

Click 'Finish'. You will see the project tree similar to the one shown in the picture below.


Step 6:

Edit your RichFaces->WebContent->WEB-INF web.xml & faces-config.xml, go to src tab and type the contents shown in the images below:

web.xml (Iam not able to properly indend & color the XML file hence the picture. If you need the XML files write to me. I will mail it to you)

faces-config.xml (Iam not able to properly indend & color the XML file hence the picture. If you need the XML files write to me. I will mail it to you)

Save your web.xml & faces-config.xml.


Step 7:

Create index.html & iexplore.jsp under RichFaces->WebContent and copy paste the contents below.

(Iam not able to properly indend & color the file hence the picture. If you need the file write to me. I will mail it to you)

(Iam not able to properly indend & color the file hence the picture. If you need the file write to me. I will mail it to you)


Step 8:

Right click 'Java Resources: src' in you project tree and select New->Package to create a package called richfaces.managedbeans.

Create Java files named
The files listed above are available @

In case you are not seeing the files under the abover URL, then navigate to
  2. Click RichTrees in the Left panel bar
  3. Click Recursive Tree Adaptor
Once you are done copied the java files to your richfaces.managedbeans package you need to do the following :
  1. All the java files has package name as package org.richfaces.treemodeladaptor. Change it to 'richfaces.managedbeans'.
  2. Open and change the line private static String SRC_PATH = "/WEB-INF/src"; to private static String SRC_PATH = "/WEB-INF";
Your project tree should look like this :


We are going to create a properties file called under your RichFaces->Java Resources:src.

Step 9:

Right click Java Resources:src and choose New->Other. Choose General->File and click Next.

Select RichFaces->src folder. Input '' for the File name and click Finish.

Open, copy & paste the following line in the editor and save the file.

appname=File System Explorer


Lets run our RichFaces web application. Before we run you should know what the application is going to display in the browser window inside eclipse.

The index.html is going to navigate to iexplore.jsp file.

The iexplore.jsp is going to read the file structure under your deployed web application WEB-INF and display it using the RichFaces <rich:tree> and <rich:recursivetreenodesadaptor> components.

This application may sound too much for a beginer, but once you get it up and running you will learn everything you want to build a sophisticated RichFaces web application. That is my motto !

Step 10:

Right click on RichFaces->WebContent->index.html and select Run As->Run on Server

Under 'Select the server type' choose 'Tomcat v6.0 Server' and click Next.

Click on 'Browse' button under 'Tomcat installation directory'.

Choose you (on my system it is C:\Program Files\Apache Software Foundation\Tomcat 6.0)

Click Next. The wizard should look like the one shown below.

Click 'Finish'. Eclipse will start the tomcat server and deploy your RichFaces web application.

You should see the following in the eclipse browser.

CONGRATULATIONS ! You have learned all the technologies needed to develop RichFaces/JSF web applications.

Note 1: If you are stuck or if any of the download links are broken please write to me. I will fix it in this article.

Note 2: I didn't had time to explain in detail about the web.xml & faces-config.xml. I will explain them later on demand.

Thursday, October 9, 2008

Eclipse RCP Update Manager

Today, I did tried adding the update manager UI and setting up an update site for my eclipse RCP application. Everything went fine. I did set up the menu item Update->Software Updates. Added my update site and able to locate the new features :) I was happy and believe me its a cool feature eclipse provides. But the moment I selected my new feature under (Select the features to install), the 'Updates' dialog throws the following error :

Resulting configuration does not contain the platform

oops ! I tried debugging this issue for hours. Googled .... and found out that for your Update Manager to work properly you need to have everything as a feature and no-plugins. If you created a product file for your eclipse RCP application with 'plugins' turned on under 'The product configuration is based on:' tab of your product files 'Overview' section, you need to changed the option from 'plugins' to 'fetaures'. Hold on ! You have other things to do ....

I would suggest you to follow the Section 9 - Add Update-Manager to rcpmail of

I got this link from the eclipse RCP FAQ Page -

Don't give up. It worked for me and definitely it will work for you too.

Write to me if you still find it difficult to make it work. I will help you.

Wednesday, August 13, 2008

Attn SWT Developers !

Every SWT developer should browse before you decide to go with SWT. Iam not against SWT ! Iam actually an EClipse RCP programmer. You should know what you are doing before you start. Once started there is no way out !

Eclipse SWT vs Swing

Good discussion on Eclipse SWT vs Java Swing

Sunday, August 10, 2008


HARI is Lord Vishnu. HARAN is Lord Shiva. Hari and Haran are one and the same said Thiru Boothathu Azhvar. Boothathu Azhavr is one of the 12 azhvars who praised, loved and lived thinking about Lord Vishnu always.

SHIVA and VISHNU are one and the same playing different roles.


NARA meaning Water in Sanskrit. AYANA meaning sleep/reside/meditate in Sanskrit. NARAYANAN is one who sleeps on water.


Say it again and again ! The mantra that purifies your mind, thoughts and body. You see it in every Vishnu temple. This mantra has lots of link with a place called Thirukostiyur near Karaikudi in Tamil Nadu. Sri Ramanajua learned this manthra from his guru in exchange of a promise on Shri Lakshmi Narasimha Murthy (Avathar of Lord Vishnu) that he won't say it out for common people. The moment he learned this mantra from his guru he yelled it sitting on top of the Thirukostiyour temple. Sri Ramanuja wants every human to know this mantra and get his soul purified saying this mantra again and again. Eventually his guru realized that its a great mistake from his part for not saying this mantra out and keeping it known to a very closed circle. He praised Shri Ramanuja then.

Thirukostiyur temple is one of the 108 sacred Vishnu temples and speaks about the unique shaped architecture of the ancient kings of Tamil Nadu. Thirumeiyyam another great temple of Lord Vishnu is located near Thirukostiyur. Thirumeiyyam is also one of the 108 sacred Vishnu temples.