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

36 Comments

  1. katick says:

    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. max says:

    @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. Ray says:

    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. max says:

    Right now we offer on-site JSF, RichFaces and Seam training. You have my email, if you have any questions on training, just email me.

  5. Tiho says:

    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. max says:

    @Tiho: JBoss AS already has JSF libraries, so the first thing you should try is removing JSF libraries from project template.

  7. Sampath says:

    Can you provide a template project that works for JBoss AS 5.1? (Similar to tomcat 5.5 and 6 templates you have).

  8. max says:

    @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?

  9. Sampath says:

    Yes, I’m looking for plain JSF RichFaces project (no Seam) on JBoss AS.

  10. max says:

    @Sampath: will probably have time next week. For now, try to remove JSF libraries from Tomcat template and deploy on JBoss AS.

  11. max says:

    @frank: file updated. I think Facebook bought Drop.io last year and they stopped supporting all old uploads.

  12. kenji says:

    what about this post for RF 4? 😉

  13. max says:

    @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.

  14. Leo K says:

    thanks! I will give it a try!

  15. akram says:

    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

  16. max says:

    @arkam: just point to the zip file.

  17. akram says:

    Hi Max,

    I pointed to the zip file but the Finish button is disabled, here is a picture on how it looks like :

    http://imageshack.us/photo/my-images/268/eclipseg.jpg/

    Thanks

    Your help is appreciated.

    Akram

  18. max says:

    @arkam: I think you selected General/Archive File. You need to select General/Existing Projects into Workspace

  19. akram says:

    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

  20. max says:

    @akram: if you have the book, then continue reading. There are also many RichFaces resources on the internet.

  21. Andres says:

    Hey, thanks!!!

  22. Madhu says:

    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?

  23. Madhu says:

    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)

  24. Madhu says:

    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

  25. max says:

    @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

  26. Dani says:

    Thank you.

    It was very helpfull for me. I’ve been looking for a working “helloworld” for two days.

    Thanks again.

  27. Nithin kongadan says:

    thank you it very easy to deploy on tomact 7.0

  28. Nagarjun says:

    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.

    1. max says:

      This project template is almost four years old. I’d go to RichFaces project page and get the latest project template.

  29. Mwass Mwas says:

    Hi guys ,am trying to set up richfaces 3.3 on neatbeans 8.1 but i can’t seem to figure it out, kindly help.

Leave a Comment

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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.