Home » Enterprise Java » jsf » JSF 2.0 Eclipse IDE support

About Thodoris Bais

Thodoris Bais
Thodoris is an Oracle Certified Associate Java Programmer and works as a Junior Software Developer, in the banking sector. He pursues a diploma at Informatics & Telecommunications Engineering and is interested in entrepreneurship and startups.

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.

Want to be a JSF Ninja?

Subscribe to our newsletter and download the JSF 2.0 Programming Cookbook right now!

In order to get you prepared for your JSF development needs, we have compiled numerous recipes to help you kick-start your projects. Besides reading them online you may download the eBook in PDF format!

 

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!

Do you want to know how to develop your skillset to become a Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!

1. JPA Mini Book

2. JVM Troubleshooting Guide

3. JUnit Tutorial for Unit Testing

4. Java Annotations Tutorial

5. Java Interview Questions

6. Spring Interview Questions

7. Android UI Design

and many more ....

 

Want to take your Java Skills to the next level?
Grab our programming books for FREE!
  • Save time by leveraging our field-tested solutions to common problems.
  • The books cover a wide range of topics, from JPA and JUnit, to JMeter and Android.
  • Each book comes as a standalone guide (with source code provided), so that you use it as reference.
Last Step ...

Where should we send the free eBooks?

Good Work!
To download the books, please verify your email address by following the instructions found on the email we just sent you.