Felipe Gaúcho works as senior software engineer at Netcetera AG in Switzerland. He is a well known Brazilian JUG leader and open-source evangelist. Felipe works with Java since its early versions and has plans to keep that Java tradition as it is. When he is not coding, he prefers to listen reggae and travel around with his lovely wife Alena and his son Rodrigo. Felipe is a DZone MVB and is not an employee of DZone and has posted 29 posts at DZone. View Full User Profile

True Abstraction Revisited: Composite UI Components in JSF 2.0

12.30.2009
| 4846 views |
  • submit to reddit

I got some difficulties following the tutorial about creating components with JSF 2.0, mainly due to some obsolete instructions and Maven dependencies of the more than 1 year old original articles of Ed Burns. I wrote down upgrades instructions in a hope to help other newbies to create composite UI with JSF 2.0. Nevertheless, you should read the original text because I won't explain the concepts behind creating Composite User Interfaces and neither rephrase Ed Burns. I will just give you en updated version of the same project, with the same xhtml code. I am using Eclipse on the Karmic Koala Ubuntu 9.10 but the below instructions should work everywhere :)

The original articles from Ed Burns:

There are tons of related material on the web, but after reading several blogs and tutorials I've choosen the Mr. Burns' ones due to the simplicity of the example. If you know other good material to start learning UI composite elements with JSF 2.0, please write the URL in the bottom of this page. The original text is based on Netbeans and depends on a local copy of javaee and jsf libs. I replaced that for Maven dependencies and I also adapted the example to Eclipse but there is no dependency to any Eclipse feature, you are free to choose your IDE since the code is a pure Maven project.

  1. Install Glassfish v3 and Maven 2.x

  2. Download the sample project and unzip it somewhere

  3. Go to the folder you unziped the sample project and type the following commands:

    mvn -Dwtpversion=2.0 compile package eclipse:eclipse

    asadmin start-domain

    asadmin deploy target/jsf-example01.war

  4. Open the project URL with your browser: http://localhost:8080/jsf-example01/index.jsf

    You should see something like the below image:

You should be able to import the project in Eclipse and also to use the Glassfish Eclipse Plugin to run and/or debug the project directly inside the IDE. Be my guest to ask about this example, I am also learning here but eventually I am one step further :). And if you need advanced hints about JSF, please join the Mojarra mailing list, the quality and the velocity of the responses are impressive.

From http://weblogs.java.net/blog/felipegaucho

Published at DZone with permission of Felipe Gaúcho, 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.)

Tags: