As the title clarifies, in my very first tutorial, we are going to take a glance at setting our Eclipse IDE, in order to support JSF 2.0.
Older Eclipse EE versions, such as Ganymede (v3.4) and Galileo (v3.5), support only JSF 1.2. In order to work with JSF 2.0, you just have to own an Eclipse EE version of Helios (v3.6) or onward, which has by default full support of Java EE 7, including JSF 2.0.
Tools Used :
- Eclipse EE Kepler (v 4.3)
- JSF 2.2
1. Eclipse Project Facets
First, we have to create a JSF custom library, which will be available each time we want to cooperate with JSF. The most common and easy way to do this, is to configure an existing project, in order to support Web Tools Platform (WTP).
Steps to enable the Web Tools Platform (WTP) :
- Right click on an existing project and select Properties
- While on Properties window, select Project Facets
- Make sure that the version of your Dynamic Web Module is at least 2.5
- Tick the Java checkbox and select the 1.6 (or 1.7 l it depends on what is the latest version of Java that you have installed) version.
- Tick the JavaServer Faces checkbox and select 2.2 version.
You should now be informed that a further configuration is required. Hover over the link and click it!
Now it’s the time to create our stable User Library:
- In the Modify Faceted Project window, click the download icon
You should at least see a JSF 2.2 library, as shown below (here, we do not have any other available views, because our example pc already supports 2.0, as you correctly noticed) :
- Click Next, accept the License Agreement and hit Finish
- Check JSF 2.2 (Mojarra 2.2.0) and hit OK.
Success!You just accomplished to configure JSF 2.2 on Eclipse IDE!. Let’s try it out, by creating a sample
.xhtml file, which will be the very first page in our website.
I’m sure you know hot to implement such an easy action, but just to follow along:
- Right click the project’s Web Content folder.
- Hit New => HTML File.
- Name your file
- Select the
1.0 strictxhtml template and hit Finish
And a small annotation : if you want to make your life easier, especially according to the front-end part of your application, Eclipse EE also provides a Web Page Editor. Let’s see what I mean :
- Right click on the
index.xhtmlyou just created.
- Select Open With => Web Page Editor.
Yeah, that’s it! This view provides a full Web Palette to assist you while developing your J2EE applications! Just in case you didn’t noticed what happened, here is the exact screenshot :
What comes after configuring? Getting up and running, of course ; and you guessed it right, the fore-mentioned picture is from next example’s JSF application.
This was an example of configuring Eclipse IDE in order to support JSF 2.0.
So, in our next JSF example, we ‘ll find out how to develop a simple
Hello World application. Stay tuned!