Exercise 1.1: Setup

Before beginning portlet and portal development in this tutorial, there are a series of setup steps that you must perform:

  1. Creating a project and importing resources required for portlet development.
  2. Installing and configuring the WebSphere Portal v5.1 Test Environment, which will allow us to test the application that we are building.
  3. Configuring a database server that will supply data to run in the application.

The first step is to import pre-built EJB and EJB client projects into the portlet project that we will use in the tutorial. The AuctionPortletEAR created when you create the portlet project will contain the imported resources. These projects provide the back-end services that we will use to create the portlet included in the portlet project.

Creating a new portlet project

All portlet development is performed in the context of a portlet project. To create the portlet project for the UserAdmin portlet, follow these steps:

  1. Open Rational Developer.
  2. Select File > New > Project.
  3. Select the Portlet Project option. This option will generate project resources that support the IBM portlet API, as opposed to the JSR 168 portlet API. Click Next.
  4. Click OK in the Confirm Enablement dialog. This dialog verifies that you want to enable Portal Development capabilities. Capabilities are the elements of your development environment, along with the appropriate set of tools, that automate many of the programming standards and code generation capabilities required for developing portal-based Web applications that will run on WebSphere Portal.
  5. Name the project AuctionPortlet.
    When you type in the name of the project, notice that (if you click the Show Advanced >> button) the module for this project is automatically added to a like-named EAR project.
  6. Note that the WebSphere Portal version defaults to 5.1. Click Next.
  7. Select the Faces Portlet radio button, because the portlets that will be created in this tutorial will leverage the speed and flexibility provided by JavaServer Faces and the portlet tools in building user interfaces for Web applications. Click Next.
  8. Click Next again.
  9. In the Portlet Settings page, type UserAdmin portlet in Portlet name field, and User Admin in Portlet title field.
  10. Select the Change code generation options check box. Type UserAdminPortlet in Class prefix field.
  11. Click Next.
  12. In the Miscellaneous page, notice that the Initial page value in the View mode group is /UserAdminView.jsp. This default page will be generated within the project, and will serve as the master page of the UserAdmin portlet. We will add additional pages in future exercises.
  13. Click Finish.

    If you are prompted to switch to the Web Perspective, click Yes.

The default portlet view page, UserAdminView.jsp, is displayed in the editing area of your workspace.

Importing the resources used in this sample

To import AuctionPortal.zip, which contains all pre-built project resources necessary to create the interfaces and data access described in the tutorial:

  1. From the menu bar, select File > Import. The Import dialog appears.
  2. Under Select an import source, click Project Interchange.
  3. Click Next. The Import Project Interchange Contents dialog appears.
  4. Because different Rational products use different installation target locations, you must leave the product's user interface to locate the plug-in that contains the database content. Use a file search tool to locate the com.ibm.etools.portal.examples.application_6.0.0.1 plug-in folder under the product installation path in your local file system.
  5. Next to From zip file, click Browse and navigate to AuctionPortal.zip in the following location:
    x:\com.ibm.etools.portal.examples.application_6.0.0.1/samples
    where x: is the absolute path that contains the com.ibm.etools.portal.examples.application_6.0.0.1 plug-in on your computer. Click Open.
  6. Select the AuctionEJB50 and AuctionEJB50Client check boxes.
  7. Click Finish.

    The wizard imports the projects into your workspace.

  8. You must also add the imported projects as modules to the AuctionPortletEAR project. In the Project Explorer, expand Enterprise Applications > AuctionPortletEAR and double-click Deployment Descriptor: AuctionPortletEAR.
  9. Select the Module tab.
  10. Click Add under Modules. Select AuctionEJB50 and click Finish. If the Change Target Server dialog asks you to change the module target server to the EAR target server, click Yes.
  11. Click Add under Project Utility JARs. Select AuctionEJB50Client and click Finish. If the Change Target Server dialog asks you to change the module target server to the EAR target server, click Yes.
  12. Save and close the Deployment Descriptor.

Installing and configuring the WebSphere Portal v5.1 Test Environment

Although the WebSphere Portal v5.0 Test Environment is installable from the product launchpad, the resources in this tutorial are designed to run on WebSphere Portal 5.1. You must install the WebSphere Portal 5.1 Test Environment as described in the product Installation Guide. The installation requires that you use WebSphere Portal media that is provided with Rational Developer.

After installing this version of the test environment, you must also configure it to run in your workspace:

  1. Select Window > Preferences from the menu bar.
  2. Expand the Server section, and click Installed Runtimes.
  3. Click WebSphere Portal v5.1 stub, select the check box, and click Edit.
  4. Change the name to WebSphere Portal v5.1 and overwrite the WebSphere Portal Location and WebSphere Application Server Location values with the WebSphere Portal 5.1 test environment installation directories that you specified when you installed the test environment.
  5. Click Finish.
  6. Click OK in the Preferences dialog box.

After completing these steps, the WebSphere Portal v5.1 test environment server is available for testing, debugging, or profiling.

Next, you must configure a database server that contains the data used by the applications in this tutorial.

Creating and configuring a server that contains a sample application database

In this exercise, you must import and configure a Cloudscape database to provide data for the AuctionPortal application.

  1. Display the Servers view. It is located near the Properties and Quick Edit views.
  2. Select New > Server from the view's pop-up menu.
  3. Select WebSphere Portal v5.1 Test Environment from the server type list.
  4. Click Finish.
  5. Double-click WebSphere Portal v5.1 Test Environment in the Servers view.
  6. Select the Data sources tab in the server editor.
  7. In the Server Setting section, click Add to add a listing to the JDBC provider list.
  8. In the first page of the Create a JDBC Provider wizard, select Cloudscape as the Database type, and Cloudscape JDBC Provider as the JDBC provider type.
  9. Click Next.
  10. Type Cloudscape JDBC Provider in the Name field.
  11. Click Finish.
  12. Click the Add button next to the Data source defined in the JDBC provider selected above list.
  13. In the first page of the Create a Data Source wizard, select Cloudscape JDBC Provider, and click Next.
  14. Type Auction in the Name field.
  15. Type jdbc/auction in the JNDI name field.
  16. Click Next.
  17. Select databaseName from the Resource Properties list.
  18. Because different Rational products use different installation target locations, you must leave the product's user interface to locate the plug-in that contains the database content. Use a file search tool to locate the com.ibm.etools.auction.sampledb_6.0.0 plug-in folder under the product installation path in your local file system.
  19. Return to the Create a Data Source wizard, and type the following path in the Value field:
    x:\com.ibm.etools.auction.sampledb_6.0.0\db\AUCTION60
    where x: is the absolute path that contains the com.ibm.etools.auction.sampledb_6.0.0 plug-in on your computer.
  20. Click Finish.
  21. Save and close the server configuration file.

Now you will be able to access data in the AUCTION60 database when you test the portlets in the AuctionPortlet project, as they are developed in Module 1.

About the files used in this tutorial

You can now browse the files in the AuctionEJB50 and AuctionEJB50Client projects, which includes the data sources and logic for the portlet pages. In the project Explorer view, when you expand the folders, the contents should resemble the following:
AuctionPortletEJB in the Navigator view

The resources in this project will be used to create the user interfaces for the portlets that we will create in this tutorial, and provide access to the data in the sample Cloudscape database. UserFacade and ListingFacade are the EJB session beans that will supply methods that will be called from the portlets created in the tutorial. RegistrationData and ItemData are data access beans that will be used to carry data between portlets and the Cloudscape database, using entity beans. The EJB project provides database mappings for the entity beans.

Now you are ready to begin Exercise 1.2: Preparing for portlet development and defining the application flow.

Terms of use | Feedback
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.