Display dynamic information on Web pages
with JavaServer Faces
ii Display dynamic information on Web pages with JavaServer Faces
Contents
Display dynamic information on Web
pages with JavaServer Faces . . . . .1
Display dynamic information on Web pages with
JavaServer Faces . . . . . . . . . . . . .1
Module 1: Create Web pages with data connections .3
Lesson 1.1: Import the required resources and
setting the target server . . . . . . . . . .4
Lesson 1.2: Connect to a database and display
data on a Web page . . . . . . . . . . .6
Lesson 1.3: Test the Web site . . . . . . . .12
Lesson 1.4: Create a new record to display and
update the database . . . . . . . . . .14
Lesson 1.5: Program the Submit button . . . .17
Lesson 1.6: Create an update page . . . . . .20
Lesson 1.7: Filter a relational record list . . . .25
Module 1: Summary . . . . . . . . . .28
Module 2: Add advanced features . . . . . . .30
Lesson 2.1: Format a data table . . . . . . .34
Lesson 2.2: Use the file upload component . . .42
Lesson 2.3: Use navigation rules . . . . . .44
Lesson 2.4: Use automatic key generation . . .46
Module 2: Summary . . . . . . . . . .49
Display dynamic information on Web pages with
JavaServer Faces . . . . . . . . . . . . .49
iii
iv Display dynamic information on Web pages with JavaServer Faces
Display dynamic information on Web pages with JavaServer
Faces
This tutorial will teach you how to design a dynamic Web site that functions as a newspaper’s classified
advertising section. The Web site is a complete J2EE Web application that uses JavaServer Faces (JSF)
components and Service Data Objects (SDO) components. The Web application uses JSF technology to
create dynamic Web pages that link to a database that stores classified advertising data.
Learning objectives
This tutorial is divided into two modules, each with its own learning objectives. You can choose to
complete either or both modules. Within each module, you must complete the exercises in order for the
Web site to work properly.
Module 1: Create Web pages with data connections
This module teaches you how to set up a connection to a database and display the information from the
database on a Web page. In this module, you will:
v Connect Web pages to a database.
v Create pages that display, create, edit, and delete records from the database.
v Create a basic search results page.
v Send data from one page to another
Module 2: Add advanced features
This module teaches you more powerful ways to use data from a database. In this module, you will:
v Format database records on a Web page
v Add a component that allows uploading files to a database from a Web page
v Navigate from page to page automatically
v Automate some database administration tasks
When
you are ready, begin Module 1: Creating Web pages with data connections.
Time required
Total: 3 hours and 30 minutes
Module 1: 2 hours
Module 2: 1 hour and 30 minutes
Display dynamic information on Web pages with JavaServer Faces
This tutorial will teach you how to design a dynamic Web site that functions as a newspaper’s classified
advertising section. The Web site is a complete J2EE Web application that uses JavaServer Faces (JSF)
components and Service Data Objects (SDO) components. The Web application uses JSF technology to
create dynamic Web pages that link to a database that stores classified advertising data.
This tutorial might require some optionally installable components. To ensure that you have installed the
appropriate optional components, see the System requirements list.
1