Before you start
Learn what to expect from this tutorial, and how to get the most out of it.
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.
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
This tutorial should take approximately 90 minutes to finish. If you explore other concepts related to this tutorial, it could take longer to complete.
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.
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
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
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