jsf

JSF 2.0 Eclipse IDE support

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.
 
 
 
 
 
 
 

 
Here’s the guide that will show you how to enable JSF 2.0 features in your Eclipse IDE.

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) :

  1. Right click on an existing project and select Properties
  2. While on Properties window, select Project Facets
  3. Make sure that the version of your Dynamic Web Module is at least 2.5
  4. 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.
  5. 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!

image1u

Now it’s the time to create our stable User Library:

  1. In the Modify Faceted Project window, click the download icon

configureJSF_2u

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) :

configureJSF_3u

  1. Click Next, accept the License Agreement and hit Finish
  2. Check JSF 2.2 (Mojarra 2.2.0) and hit OK.

configureJSF_4u

2. Demo

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 index.xhtml
  • Select the 1.0 strict xhtml 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.xhtml you 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 :

configure_JSF5u

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!

Thodoris Bais

Thodoris is an Oracle Certified Associate Java Programmer and currently works as a Junior Software Developer, for Intrasoft International S.A. He holds a diploma at Informatics & Telecommunications Engineering and is interested in continuous development.
Subscribe
Notify of
guest

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

1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
kausar
kausar
2 years ago

hi,

Im using eclipse 4.1, however in Properties, there is no JavaServer Facet option.

I’m not sure which step I’m missing

thanks

Back to top button