The easiest way to start with RichFaces

Now that RichFaces 3.3.3 is out, plus JBoss Tools 3.1 was released in March, let me show you the easiest way to start with RichFaces and Tomcat 6. This doesn’t involve Maven. I’ll write a post about Maven and RichFaces some other time.

The following steps assume you have JBoss Tools 3.0 or 3.1 installed. Just in case you don’t have JBoss Tools installed, skip to section Installing JBoss Tools 3.1 at the end.

Getting RichFaces project

  1. Download RichFaces start project
  2. In Eclipse, select File/Import/General/Existing Project into Workspace
  3. Check Select archive file and click Browse…
  4. Find and select richfaces-start.zip
  5. Click Finish
  6. Once the project is imported, in Servers view, right-click Tomcat server and select Add and Remove…
  7. Move richfaces-start to the right side
  8. Start the server
  9. Right-click richfaces-start project and select Run As/Run nn Server

You should see a page like this:

The project even comes with a very short custom skin (laguna14). Look for the skin file in JavaSource folder. The application also uses a4j:insert tag and a4j implicit object.

Installing JBoss Tools 3.1

  1. Download and install Eclipse IDE for Java EE Developers 3.5.2
  2. In Eclipse, go to Help/Install New Software…
  3. Click Add
  4. For name, enter JBoss Tools 3.1
  5. For URL, enter http://download.jboss.org/jbosstools/updates/JBossTools-3.1.0.GA/
  6. Click OK
  7. Select the just added software link
  8. When a list of features appears, select Web and Java EE Development
  9. Click Finish. This will install JBoss Tools
  10. Launch Eclipse
  11. Add Tomcat 6 server (you can do it via Servers view)
  12. Go back to step #1 in Getting RichFaces project section

35 thoughts on “The easiest way to start with RichFaces

  1. Hello Max,

    Thanks for your excellent work all time. Can you please give us step by step tutorial to develop custom components using Richfaces. Thank you

    -Katick

  2. @Katick: You welcome. Once RichFaces 4 is out with its new CDK (Component Development Kit) I will start blogging on how to create custom rich components. The CDK in version 4 is going to be a lot simpler to use.

  3. Thank you for this pretty headstart. My you please advise me. I have been following yo blog material for 2 weeks now but i would like a training on Seam and Richfaces,EJB,JPA,JSF etc because i would want to know how to develop a complete application using these technologies. I have the books Practical Richfaces and Jboss Richfaces 3.3 but i still believe Training will do because the books seem to skip some elements that i find crucial e.g in Jboss Richfaces 3.3 they dont describe creating the application in Eclipse or Netbeans but rather use Seam gen , my point is wat happens if seam-gen fails like what happened when i tried to create the main example application

    Thanx

  4. Pingback: Most popular (and useful) RichFaces posts | Maxa Blog

  5. Thank you for the project!
    Still I would have a question. I try to deploy the example project on JBoss (Community) 5.1 server and there is some deployment error. What should be changed to get it work on JBoss server(s)?

  6. @Sampath: I could but you can also just create a new Seam project. It comes with RichFaces. Or you are looking for just plain JSF RichFaces project (no Seam) on JBoss AS?

  7. Pingback: Maxa Blog » Plain JSF/RichFaces project on JBoss AS

  8. Pingback: Maxa Blog » Updated: Easiest way to start with RichFaces 3

  9. @kenji: to be honest, Maven RichFaces archetype would be the simplest way to start. You can find instructions here: http://goo.gl/SS9m0 Once you got the project, you can easily import it into Eclipse.

    But, I’ll post something similar when I have more time.

  10. Hi,

    I am trying to follow the steps :

    Getting RichFaces project

    1.Download RichFaces start project
    2.In Eclipse, select File/Import/General/Existing Project into Workspace
    3.Check Select archive file and click Browse…
    4.Find and select richfaces-start.zip

    From archive File : C:Majidrichfacesrichfaces-start.zip

    Should I select something in :
    Into Folder ?

    Because Finish button is disabled.

    Thanks

  11. Thank you Max, (and sorry for General/Archive File instead of General/Existing ),

    Now it’s working, I got :

    Hello, looks like it’s working

    Now, do you think shoud I continue in your book : Practical RichFaces or there is another book or tutorial to do so (I am a newbie ignorant in JSF and RichFaces).

    Thanks .

    Akram

  12. Hi,
    Thanks for the example. I am trying to modify this to add a Managed Bean. But when I add the bean to faces-config.xml, I get
    com.sun.faces.mgbean.ManagedBeanCreationException: Unable to create managed bean fBAccess. The following problems were found:
    – Bean or property class model.FBAccess for managed bean fBAccess cannot be found.

    Could you help me with this?
    start.xhtml now has :

    FBAccess.java

    package model;

    public class FBAccess {
    public FBAccess() {

    }

    private String firstString = “Hello”;

    public String getFirstString() {
    return firstString;
    }

    public void setFirstString(String firstString) {
    this.firstString = firstString;
    }
    }

    faces-config.xml:

    fBAccess
    model.FBAccess
    request

    What am I missing here?

  13. Full Exception:
    SEVERE: Error Rendering View[/Page1.jsp]
    com.sun.faces.mgbean.ManagedBeanCreationException: Unable to create managed bean fBAccess. The following problems were found:
    – Bean or property class model.FBAccess for managed bean fBAccess cannot be found.
    at com.sun.faces.mgbean.BeanManager.create(BeanManager.java:204)
    at com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:86)
    at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:67)
    at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:72)
    at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:71)
    at org.apache.el.parser.AstValue.getValue(AstValue.java:147)
    at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189)
    at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
    at javax.faces.component.UIOutput.getValue(UIOutput.java:184)
    at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:201)
    at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:284)
    at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:154)
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:861)
    at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:281)
    at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:258)

  14. Sorry, the tags are messed up, please ignore the syntax
    h:outputText value=”#{fBAccess.firstString}”

    faces-config.xml:
    managed-bean
    managed-bean-name>fBAccess managed-bean-name
    managed-bean-class>model.FBAccess managed-bean-class
    managed-bean-scope>request managed-bean-scope
    managed-bean

  15. @Madhu: check that the compiled class ends up in the deployment. Sometimes Eclipse doesn’t copy the class for some reason. The project is deployed here: workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps

  16. Hi i am trying to add a above link in repository. after adding the link its gives an error that “DUPLICATE LOCATIN”.i choose a new workspace also and getting same error.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s