Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your profile (name, country/region, and company) is displayed to the public and will accompany any content you post. You may update your IBM account at any time.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Build a JSF search page with EGL using Rational Business Developer

Create two pages that allow a user to search a database in different ways

Tim McMackin, Software engineer, IBM
Author photo
Tim McMackin is a technical writer for IBM's Enterprise Generation Language in Raleigh, NC. He has a background in writing for advertising technical products and has been with IBM since 2004.

Summary:  This tutorial teaches you how to use Enterprise Generation Language (EGL) and Java™Server Faces (JSF) components in IBM® Rational® Business Developer. In this tutorial, you create two pages that allow a user to search a database in different ways. These pages accept input from the user, search the database for records that match the input, and display the results on the same page.

Date:  22 Jul 2008
Level:  Intermediate PDF:  A4 and Letter (1450 KB | 63 pages)Get Adobe® Reader®

Activity:  21082 views
Comments:  

Before you start

Learn what to expect from this tutorial, and how to get the most out of it.

About this tutorial

This tutorial expands on the tutorial Learn how to create a Java Web application without knowing the Java language using IBM Rational Business Developer by teaching you more advanced uses of Enterprise Generation Language (EGL) and Java™Server Faces (JSF) components in IBM® Rational® Business Developer. In this tutorial, you create two pages that allow a user to search a database in different ways.

These pages accept input from the user, search the database for records that match the input, and display the results on the same page. This is not the only way or the best way to create a search page, but this way illustrates several important EGL and JSF concepts.

The search pages you create in this tutorial are very different from Web search engines or pages that search the Internet or a single Web site. The search pages you create in this module search for database records, not for Web pages or information on Web pages.


Objectives

In this tutorial, you learn how to do these tasks:

  • Use SQL statements to filter results for a search page
  • Create a customized EGL record part and display it on a page
  • Populate a JSF combo box with dynamic data
  • Apply type-ahead support to an input control
  • Update a portion of a page based on an AJAX request

Time required

This tutorial should take approximately 90 minutes to finish. If you explore other concepts related to this tutorial, it could take longer to complete.


Prerequisites

Before you start this tutorial, you must complete the tutorial Learn how to create a Java Web application without knowing the Java language using Rational Business Developer.


Tutorial application

When you are finished with the tutorial, you will have a search page that can take input from users, compare it against the data in a database, and return results to the user. You will learn how to create a search that uses two parameters simultaneously (an AND search). You will also learn to change that search to one that uses one or the other of the two parameters (an OR search), and you will place a radio button group on the page to allow the user to choose between types.

You will also learn how to limit the user's choice of search parameters by placing a combo box on the page: this presents a list of selections to the user instead of allowing them to type in a string. Finally, you will learn how to customize the search results, combining fields and determining how the output appears on the page.

The first completed search page will look like that shown in Figure 1.


Figure 1. First search page
tab with fields and results

The second search page that you will create demonstrates some simple uses of AJAX functionality with EGL. One common use of AJAX is to provide suggestions for user input as type-ahead support. In this way, the page searches the database for items similar to what the user has already typed in an input field, as shown in Figure 2.


Figure 2. AJAX type-ahead support
Type s, words that begin with s display

Once the user has accepted one of the suggestions, the page will use another AJAX request to display the database information without reloading the page:


Figure 3. Display details about accepted suggestion
results include ID, first and last name, and phone

1 of 11 | Next

Comments



static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Rational
ArticleID=321226
TutorialTitle=Build a JSF search page with EGL using Rational Business Developer
publish-date=07222008
author1-email=tmcmack@us.ibm.com
author1-email-cc=