Creating New Eclipse Project without Plugin

Table of Contents

Creating New Eclipse Project with Eclipse Luna and ICEfaces 4 Without a Plugin.

A plug-in is not required meaning that users do not need to wait for one to be developed before using the latest releases with the Eclipse IDE. Following these simple steps using Eclipse Luna (Java EE download) and ICEfaces-4.0.0.GA to create a new Eclipse web project for Tomcat 7.

Development Tools Used

The following tools are used in this tutorial:

  • Eclipse IDE for Java EE Developers. Eclipse Luna (v4.4)was used for this tutorial.
  • Tomcat 7.x Web Server
  • Java 6.x or 7.x

    Download ICEfaces 4

  • ICEfaces downloads Download ICEfaces 4.0.0

    Creating a Dynamic Web Project with JSF 2.2

    Step 1 Simply start up Eclipse and then create a Dynamic Web Project

    Step 2 Add the correct jsf 2.2 library. Check the release notes of the particular ICEfaces bundle you have downloaded to determine which versions are supported. Reviewing ICEfaces-4.0.0-RC1 release notes indicates Mojarra 2.2.7 is supported, so that would be the version we will include in this project.

    Instead of the standard jsf 2 library (currently 2.2.0), we will use the version in our distribution bundle. Later will show how to use maven to download the correct libraries. Click on the icon that looks like books on the inserted image above, then you will add the library shown from your downloaded ICEfaces 4 distribution bundle as below:-

    Now you have the 2.2.7 Library as a User Library in Eclipse to use for all your projects using ICEFaces-4.0.0-RC1. You can also create an ICEfaces4 Library (include icefaces, icepush, icefaces-ace and/or icefaces-mobi) in the same manner, however, if you are sharing the project with others use Eclipse, this is not recommended as the path will not always be the same. So, now we will add the ICEfaces library directly into this project. If you are using maven, this is not an issue as the maven pom will access a shared repository for all users. (insert link to maven info here).

JSF 2 Facelet Templates

Create a new directory/folder under WEB-INF, called "templates" and use Eclipse wizards to create some new Facelet Template by choosing the New Html Page wizard. First choose the following option to create the basic template for JSF:-

You must make a simple change with this template. Modify the <head> start and end tag to <h:head> as well as the <body> tag in the facelet template to <h:body>. ICEfaces has this requirement, so any view page that ICEfaces will be applie to must have this. By using templating, this only has to be done once.

Now you can use the New Html File wizard to create as many "New Facelet Composition Page" as you require. On the new page you create, ensure you use the name of your template (in this case it was templates/baseTemplate.xhtml". The wizard will provide you with template=" ". If you place your cursor between the quotes, and hit ctrl plus spacebar, Eclipse will provide content assistance and you can select the correct template. Since we have defined source pages for header and footer, we will just define a "content" definition and let the templates fill in the rest. We will add the icefaces-ace.jar and icepush.jar to the WEB-INF/lib and the ace namespace as well as icecore namespace to the page. If you would like to use mobility features, then you would also require the icefaces-mobi.jar with it's namespace. This tutorial will just consider the non-mobility project.

Before you run this, you need to modify the web.xml file in the project to use server-side state-saving:-

    <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>

You may also need to comment out the listener for jsf in the web.xml depending on which tomcat server you are using. Some of the tomcat servers will load JSF automatically, and by configuring the jsf listener in the web.xml, it will try to load it twice.

From this point, you can review any tutorial regarding icepush, the ace components, the icemobile components, or icecore support tags.

Further suggestions

You may also want to add further url-patterns in the web.xml:-

    <servlet-name>Faces Servlet</servlet-name>

There are several other context parameters that apply to ICEfaces projects, and that information is available here.

On your xhtml pages, the addition of the ace namespace will allow use of the ace components. See Information on use of ace components.
Further reference should include ace components which support mobile browsers, as well as the icecore library
For icecore tags, see list and use of icecore tags .
For tutorials using these components, see Using Ace Component tutorials.

If you are having issues with this tutorial, here is the zipped up eclipse project for if4test

Convert Eclipse Project to Maven

Eclipse has a utility all setup where you can convert an existing eclipse project to a maven project. This is quite handy as then you just have to add the repositories where your application jars are located and then the dependency of your app on these jars. First convert the existing Eclipse application to a maven application. Maven is already included as a plugin to the Luna Eclipse Java EE bundle.

This wizard will ask you for the groupId (this tutorial used org.icefaces.samples), artifactId (your app name), version, and the rest you can fill in later if you are unsure of maven. Once this wizard completes, you can see the created pom.xml that this wizard created for you.

Switch to pom.xml on the lower tab (shows the xml source view).

Add repositories that you will require for ICEfaces-4.0.0-RC1 as well as the jsf jars. This tutorial will also include the general central maven repositories since a lot of JSF applications will use things like the jstl.jar, hibernate or jpa jars, apache commons-* jars, etc.

Now add dependencies of the project, knowing that these dependencies are transitive.

You can search for the icefaces-ace pom and jar (see next screen). If you are thinking of adding push, then you can search for org.icepush in the groupId and find the icepush jar.

Since we have already created this project and copied the icefaces jars to the WEB-INF/lib, those will need to be removed (or you will have 2 copies of these jars along with the maven imports).

Also need to remove the JSF jar from the project build path as well (the convert process does not do this for you):-

Now search for the javax.faces jar by using the Maven | Add Dependency wizard from the menu:-

Then run the project!

Any questions or concerns with this tutorial can be posted to the ICEfaces Tools Forum

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

© Copyright 2021 ICEsoft Technologies Canada Corp.