This series is made up of 5 parts, and in part 2nd we created a Java Server Faces form using the Rapid application development (RAPID application Development,rad) JSF component. In part 3rd, we'll see how JSF can access data using Web data Object (WDO) technology, which will quickly become a Service information object.
Introduction
This article is part III of this series of articles that will showcase the features of the Server Faces Technology preview provided by WebSphere Studio V5.1.1.
In part 2nd, we saw how to create a JSF form using the Rapid application development (RAPID application Development,rad) Java Server Faces (JSF) component. In part 3rd, we'll see how JSF can access data using WEB data Object (WDO) technology. Wdo is a technology pioneered by IBM for the Emerging Service data Object (SDO) standards, and Service data Object (SDO) is currently being developed as JSR 235 in the Sun Java Community Process 。 JSF and SDO constitute a powerful combination that enables WEB applications to interact visually with enterprise data, and this interaction takes place with good design.
You will need to download the materials provided in this article to learn and complete this exercise. The answers to the exercises in part 2nd are included in the download file and you can open the file to see if you haven't finished the exercise. You can import this EAR file according to the instructions in part 2nd.
To run this example, we first need to create a database. We're using DB2, but we've included database scripts, considering that you might want to use DB2 as a model for different databases. After creating the database, we will use WebSphere Studio to create a Wdo component and drag it onto a display page. We will use the built-in Unit test environment (UTE) to test the application, and in the end you will see how JSF has a built-in validation framework by applying validation to the stock history form.
Setting up the database
You need to create a database before you start the exercise. To create a DB2 database, follow these steps:
If you have not yet downloaded, download the material and database scripts provided in the download section of this article.
Open the DB2 command window. You can do this by using Windows Explorer (Figure 1).
Figure 1. Open the DB2 command window
Switch to the directory where you unzipped the ZIP file and go to <extracted dir>\jsfarticleseries\part3\dbscript.
Enter the command Createwstrade (Figure 2). This creates the database table that you want. (We use Db2admin/db2admin as the user Id/password; If you want to change it, you can edit the Createwstrade.bat file.) )
Figure 2. Create a database table
To verify that the database is installed correctly, connect to the database from the DB2 Command window, for which you can enter (Figure 3): DB2 Connect to Wstrade user db2admin using Db2admin
Figure 3. Connecting to a database