< Previous | Next >

Lesson 1.1: Import the required resources and set the target server

Before you begin, you need to import the required resources for this tutorial: a set of Web pages and a sample Derby database.

The main purpose of this tutorial is to teach you how to create a Web application that enables users to access and manipulate data in a database. The tutorial does not go into the detail of designing the look and feel of a Web site. Accordingly, the Web site design has been prepared for you already.

To complete this tutorial you will need to access an existing set of JavaServer Faces JSP files and a sample Derby database. These foundational Web pages and sample database are included in a ZIP file. This lesson will take you through the steps of importing the ZIP file so you can use the Web pages and the database. You will also set the target server for the dynamic Web project.

The Web pages and database that you will use for this tutorial are included in a ZIP file. To import the content of the ZIP file:

Import the sample project file

  1. Import the project. Switch to the Web perspective (Window > Open Perspective > Web).
    Important: If newer JavaServer Faces resources or project configuration data are available, an additional error will display in the Problems view.
    Faces resources need to be updated (use QuickFix).
    To fix the error:
    1. In the Problems view, right-click the error and select Quick Fix. The Quick Fix dialog opens.
    2. In the Select a fix list, select Open resource update dialog. Then click Finish. The Update resources dialog opens with the following options.
      • Yes completes the update automatically. If a project is still undergoing active development it is recommended that the newer resources be used because in some cases the product may generate tags or attributes that will not be available at runtime until resources are updated.
      • Later defers the update decision. This will clear the Error marker for the current workbench session. To get back to the Resource Update dialog after selecting Later, close and reopen the Web project or restart the workbench to cause the background scanning to reoccur. You may need to rebuild your workspace to initiate the scan.
      • Never keeps your runtime resources at their current, older levels. If a project is already completed and functional you can choose to leave Faces resources at their current versions. The project will not be scanned again until subsequent resource versions become available in the product.
    3. For the purpose of this tutorial, click Yes to update the resources.
  2. In the Enterprise Explorer view of the Web perspective, ensure that your ClassifiedsTutorial project looks like the following image:
    Enterprise Explorer view.

Set the target server for the dynamic Web project

Setting the target server for the Web project enables you to test the resources that you will be creating in this tutorial.

To set the target server:

  1. In the Enterprise Explorer view of the Web perspective, right-click ClassifiedsTutorial and select Properties.
  2. In the properties list, click Targeted Runtimes.
  3. In the Targeted Runtimes list, select the desired runtime environment. If a runtime environment is not defined, click New to open the New Server Runtime Environment wizard and follow the prompts in the wizard.
  4. Click OK.

Lesson checkpoint

You have now imported the ClassifiedsTutorial dynamic Web project and set the target server.

You can browse the files in the tutorial Web project. To open a file, double-click it in the Enterprise Explorer view. To view a map-like representation of how the pages are related, double-click Web Site Navigation in the Enterprise Explorer.

The majority of your work in this sample will involve the following files:
all_records.jsp
This is the site's home page. It will display every classified ad in the database.
new_record.jsp
This page will create a new classified ad.
update_record.jsp
This page will change the details about an ad in the database or delete it.
classifiedTemplate.jtpl
This is the template for the site pages. It includes elements like the table and the gray "Welcome to the Classifieds" banner that are on every page. This page also has two navigational tabs below the gray banner that lead to the home page and the new classified ads page.
Now you are ready to begin Exercise 1.2: Working with the relational record list and data table components.
< Previous | Next >

Feedback