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 developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

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:  15896 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



Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

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=

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Try IBM PureSystems. No charge.