Test and run the Web application

Note

You can now test the new Web page and see if you can add a product to the database. If this is successful, you can run the complete Web application, starting from the Login page.

In this exercise, you:

Test the Addproduct.jsp Web page

Before you test your Web application, it is useful to first test the Addproduct.jsp Web page to see if you can add a product. To do this, you can temporarily change the start page for the Customer target from Login.jsp to Addproduct.jsp and then deploy and run the target.

  1. In the System Tree, right-click Customer.

    Select Properties from the pop-up menu.

    The Properties of Target Customer dialog box displays.

  2. Click the Run tab and click the browse (...) button.

    Make sure the Target tab of the Choose URL dialog box displays.

  3. Select Addproduct.jsp from the Contents of Customer list box and click OK twice.

  4. Check to see that your local EAServer is running.

    EAServer is a Web server as well as a component transaction server.

  5. In the System Tree, right-click Customer.

    Select Deploy from the pop-up menu.

    If PowerBuilder prompts you to save the Addproduct page, click Yes.

    The Output window opens and displays informational messages as the target is built and deployed.

  6. Select Run>Run Customer from the PowerBuilder menu.

    Your default browser opens. The URL address box contains the file path for the Addproduct.jsp Web page.

    Shown is a browser window with the U R L in the Address box at the top. At the top of the displayed page is the text "Click here to add new product information", then a button labeled Add New Product Information, then the text "Add a new product. Enter information into all the text boxes and click Update Data base". Next is a button labeled Update Database, and last is a link to Product Information.

    Next you add new product information using this Web page.

Add a new product to the database

Next you add new product information and update the database with the new information.

  1. Click the Add New Product Information button on the Addproduct.jsp page.

    The Web page is reloaded and an empty Web DataWindow row displays.

    Shown is a browser window with the U R L in the Address box at the top. At the top of the displayed WEb page is the text "Click here to add new product information", then a button labeled Add New Product Information, then the text "Add a new product. Enter information into all the text boxes and click Update Data base". Under this at left are text fields for Product I D, Name, and Description, and Size, then at right are a Color drop down and boxes for Quantity and Unit Price. Next is a button labeled Update Database, and last is a link to Product Information.
  2. Type the following information in the Web DataWindow:

    Text box

    Value

    Product ID

    9999

    Product Name

    Shirt

    Product Description

    Denim shirt

    Size

    Large

    Color

    Blue (select from drop-down list)

    Quantity

    6

    Unit Price

    27.95

  3. Click the Update Database button.

    This information is now in the database. You review the information next.

  4. Click the Product Information hyperlink.

    The Product.jsp page displays.

  5. Type 9999 in the Display Product information by Product ID text box.

    Click the Product by ID button.

    The Product.jsp Web page is reloaded with the product information you entered in the previous exercise.

    Shown is the Product dot j s p Web page with the text "Display Product information by Product I D" followed by the number 9 9 9 9. Under this is displayed all the product information you entered in the previous exercise.

Run the Web application

You have completed the development of your Web application. Now you change the start page back to the Login.jsp page, redeploy, run, and test the Web application.

  1. In the System Tree, right-click Customer.

    Select Properties from the pop-up menu.

    The Properties of Target Customer dialog box displays.

  2. Click the Run tab and then click the browse (...) button.

    Click the Target tab in the Choose URL dialog box.

  3. Select Login.jsp from the Contents of Customer list box and click OK twice.

  4. Check to see that your local EAServer is running.

  5. In the System Tree, right-click Customer.

    Select Deploy from the pop-up menu.

    When the Output window indicates that deployment is complete, you can run the application.

  6. Click the Run button in the PowerBar.

    Your default browser displays the Login.jsp page.

    Shown is a browser window displaying the log in dot j s p page. At top is the text Log in, please : followed by text boxes labeled Name and Password. At bottom is a Log in button.
  7. Type your first name in both the Name and Password text boxes.

    Click the Login button.

    The Welcome page displays.

    Shown in a browser window is the Welcome page with the text Welcome to Sportswear Inc, a picture of a tee shirt, and a link labeled View Product Information.
  8. Click the View Product Information hyperlink.

    The Product Information Web page (Product.jsp) displays.

    Shown in a browser window is the product information Web page product dot j s p. AT top is the text Product Information, then a text box labeled Display Product Information by Product I D, then a button labeled Product by I D, then a button labeled Add New Product.
  9. Click the Add New Product button.

    The Addproduct.jsp page displays.

    Shown in a browser window is the add product dot j s p page. At top is the text "Click here to add new product informaton", then a button labeled Add New Product Information, then the text "Add a new product. Enter information into all the text boxes and click Update Database." Below this are a button labeled Update Database and a link to Product Information.
  10. Click the Add New Product Information button.

    The Web DataWindow displays with an empty row.

    Shown in a browser window is the add product page. All the fields for adding a new product such as product I D and Name are blank.
  11. Type the following information in the Web DataWindow:

    Text box

    Value

    Product ID

    4321

    Product Name

    Tee Shirt

    Product Description

    Cotton tee shirt

    Size

    Small

    Color

    White (select from drop-down list)

    Quantity

    100

    Unit Price

    15.95

  12. Click the Update Database button.

  13. Click the Product Information hyperlink.

    The Product.jsp page displays.

  14. Type 4321 in the Display Product information by Product ID text box.

    Click the Product By ID button.

    The Product.jsp Web page is reloaded with the product information you just entered.

    Shown in a browser window is the product dot j s p page. All the fields for adding a new product such as product I D and Name are filled in with the product information you just entered. Product I D is 4 3 2, for example, and Size is Small.
  15. Close the Browser.