Thodoris Bais

About Thodoris Bais

Thodoris Bais is currently working as a Junior Java Developer while on parallel, pursuing a diploma at Informatics & Telecommunications Engineering. He specializes in Java Core, Android and J2EE and looks forward to being a professional Software Engineer. He is also a quick learner and curious about new technologies.

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.

Οlder 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!

Related Whitepaper:

Java Essential Training

Author David Gassner explores Java SE (Standard Edition), the language used to build mobile apps for Android devices, enterprise server applications, and more!

The course demonstrates how to install both Java and the Eclipse IDE and dives into the particulars of programming. The course also explains the fundamentals of Java, from creating simple variables, assigning values, and declaring methods to working with strings, arrays, and subclasses; reading and writing to text files; and implementing object oriented programming concepts. Exercise files are included with the course.

Get it Now!  

Examples Java Code Geeks and all content copyright © 2010-2014, Exelixis Media Ltd | Terms of Use | Privacy Policy
All trademarks and registered trademarks appearing on Examples Java Code Geeks are the property of their respective owners.
Java is a trademark or registered trademark of Oracle Corporation in the United States and other countries.
Examples Java Code Geeks is not connected to Oracle Corporation and is not sponsored by Oracle Corporation.

Sign up for our Newsletter

20,709 insiders are already enjoying weekly updates and complimentary whitepapers! Join them now to gain exclusive access to the latest news in the Java world, as well as insights about Android, Scala, Groovy and other related technologies.

As an extra bonus, by joining you will get our brand new e-books, published by Java Code Geeks and their JCG partners for your reading pleasure! Enter your info and stay on top of things,

  • Fresh trends
  • Cases and examples
  • Research and insights
  • Two complimentary e-books