Exercise 1.3: Testing the Web site

Before you begin, complete Exercise 1.2: Working with the relational record list and data table components.

When you are ready to publish your Web application, you will need a server that will host it so users can access the Web site through the Internet. However, to test your Web site, you can use WebSphere Application Server to simulate a server for testing purposes.

Once you have started the server, stop it before you can continue working with the site. To stop the server, see Stopping the server below.

 

Starting the server

At any time during your Web site development, you can open a page in Page Designer and use the Preview tab to see how your design will look in a browser. However, the Preview view does not allow you to see the dynamic aspects of your page (such as database connections) as they would display running from a server. To test the Web site on a server,...

  1. In the Project Explorer view, right-click the all_records.jsp file.
  2. Click Run > Run on Server from the pop-up menu. The Server Selection window opens.

    Important: You must use the same server as the one you chose to be the target server in exercise 1.1. Using a different server in this step will create errors.

    • If you are using WebSphere Application Server v6.0:

      1. Click Choose an existing server.

      2. Under Select the server that you want to use, click WebSphere Application Server v6.0.

        If you can't find WebSphere Application Server v6.0, click Manually define a server and then click WebSphere v6.0 Server to create the server.

    • If you are using WebSphere Application Server v5.1:

      1. Click Choose an existing server.

      2. Under Select the server that you want to use, click WebSphere v5.1 Test Environment.

        If you can't find WebSphere v5.1 Test Environment, click Manually define a server and then click WebSphere v5.1 Test Environment to create the server.

  3. Click Finish.

    The server tools create the new server, start it, and open the page in the workbench's internal Web browser. This may take a moment. In the Console view, you can watch the messages as the server tools start the server.

You can now preview how the site will look and work once it is actually published to a Web server. You can click the links, enter data in the forms, and see any dynamically generated content in the site that may not appear in Preview view. Also, if you wish to see your page in different Web browsers, you can copy the URL from the workbench Web browser into the browser of your choice.

 

 

Stopping the server

You must stop the server before you can continue with the tutorial. If you leave the server running, you will see error messages when you continue with the tutorial. These errors appear because the server is connected to the sample database, preventing you from connecting to the database to change the information shown on the Web site. Follow these steps to stop the server:

  1. Open the Servers view.

    This view is usually located at the bottom center of the workbench. If you can't find the Servers view, go to Window > Show View > Servers on the menu bar.

  2. In the Servers view, click the name of server that is running. Its Status is listed as Started, as in this picture:
    Servers view
  3. Click the Stop the server button at the top right of the Servers view. The server's Status changes to Stopping.

You will see messages in the Console view while the server shuts down. When the server's Status in the Servers view changes to Stopped, the server is stopped and you can continue working on the Web site.

You can test your Web site on the server at any time, but remember to stop the server when you are finished.

When you have turned off the test server, continue to Exercise 1.4: Creating new records.