True Abstraction Revisited: Composite UI Components in JSF 2.0
Join the DZone community and get the full member experience.
Join For FreeI 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:
- True Abstraction: Composite UI Components in JSF 2.0 -- Part 1
- True Abstraction: Composite UI Components in JSF 2.0 -- Part 2
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.
-
Install Glassfish v3 and Maven 2.x
-
Download the sample project and unzip it somewhere
-
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
-
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.
Opinions expressed by DZone contributors are their own.
Comments