Converting ICEfaces 1.8 Applications to 2.0

You are viewing an old version (v. 2) of this page.
The latest version is v. 37, last edited on Feb 08, 2017 (view differences | )
<< View previous version | view page history | view next version >>

Converting ICEfaces 1.8 Applications to 2.0

With the release of JSF 2.0 and ICEfaces 2.0.x, a common situation arises of porting and converting existing ICEfaces 1.8.x. This tutorial will demonstrate the required steps to convert a legacy application to "compat mode" in ICEfaces 2.0. This means you can still use your existing ice: components and backing beans, but aren't yet taking advantage of 2.0 specific features and benefits. The majority of the converting effort involves configuration files and libraries, so most of your page markup won't need to be significantly changed.

This tutorial assumes the reader has a basic understanding of JSF and ICEfaces, especially creating and working with projects related to those technologies. The focus is not to teach the foundations, but instead to learn about porting applications.

The goal of this tutorial is to examine a real world ICEfaces 1.8.x application. Once we have an understanding of the project we will begin the steps to port the application to ICEfaces 2.0. The application is a slightly modified version of the "jobApplication" used in the ICEfaces Online Training. There is a central form based page that can redirect to two pages based on different outcomes.


Here is the entire list of steps worked through during this tutorial:

  1. [Make the windowScope Project]
  2. [Add ICEfaces]
  3. [Create 3 Beans with Different Scopes]
    • [Create WindowBean.java]
    • [Create ViewBean.java]
    • [Create SessionBean.java]
  4. [Create PageController.java]
  5. [Create Two Pages]
    • [Create page1.xhtml]
    • [Create page2.xhtml]
  6. [Deploy and Test the Application]
  • [Tutorial Source Code Downloads]

Development Tools Used

The following tools were used to create the project.

1.8 jobApplication Source Code

Example Source Notes
1.8 jobApplication project [jobApplication source code |^jobApplication-1.8.zip|Download Source Code] The Eclipse workspace of the jobApplication project written in ICEfaces 1.8.

jobApplication Introduction

Download and extract the above source code bundle, and Import -> Existing Project into Workspace the folder into your Eclipse instance. Build and deploy the application to your Tomcat instance, and navigate to the deployed jobApplication. You will see a page similar to the following:

Now let's examine the page code, to get a better idea of what the application is doing. There are three main pages:

  • applicantForm.xhtml - Main page that has a series of internationalized form fields with validation, partialSubmit, a ice:selectInputDate component, etc.
  • noThanks.xhtml - Basic page redirected to when the first name equals "John".
  • thankYou.xhtml - Similar page redirected to when the first name is anything else.

The Java code is fairly standard for 1.8, focusing on two beans:

  • bean.backing.ApplicantForm.java - Controller/backing bean for the applicantForm.xhtml page. This controls the submission and some of the rendering toggles on that page.
  • bean.model.Applicant.java - Model object containing variables for the different Applicant fields, like First Name and Travel Percentage. No UI specific functionality.
  • Supporting Beans - The ProvinceSupport.java and Province.java classes are used to back the available items in the ice:selectOneMenu found on the main page.

Other features:

  • Internationalization - The messages_en.properties and JSF-override_en.properties are used to internationalize the various form labels.

Begin Converting the jobApplication

Now that we understand the project a bit better, we'll start the 1.8 to 2.0 conversion process.

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

© Copyright 2017 ICEsoft Technologies Canada Corp.