Add the ability to retrieve product information

Note

Now you add a retrieve function to the Product.jsp page. It will allow you to request the product ID for any product in the database and display the product information on the page.

  1. Open Product.jsp in Page view if it is not already open.

    Place the cursor at the end of the paragraph above the Web DataWindow and press Enter.

  2. Select Table>Table Wizard from the menu bar.

    Type 1 for the Number of Rows and click Next.

    Type 2 for the Number of Columns.

    Click Finish and OK.

    A table displays on the Web page.

  3. Highlight the word Cell in the first column and type Display Product Information by Product ID.

    Shown is the Web page with Product Information at top, then a button labeled Add New Product, then a rectangle around the text Display Product Information by Product I D Next to it is a rectangle around the word cell.
  4. Highlight the word Cell in the second column.

    Select Insert >Form Field >Single Line Text and click OK.

  5. Place the cursor after the table.

    Press the Enter key once to create and move the cursor to a new line.

    Select Insert>Form Field>Push Button from the menu bar.

    The Button Properties page displays.

  6. Select Button Type Button.

    Type cb_get in the Name text box.

    Type Product by ID in the Label text box and click OK.

  7. Select cb_get in the first drop-down list box of the Script editor.

    Select ServerAction() from the center drop-down list box.

  8. Add the following code to the script window:

    psPage.dw_1.Reset();
    psPage.dw_1.Retrieve(psPage.sle_1.value);
    
    Shown is the script window under the Product by I D button. c b _ get is displayed in a drop down on the left, and Server Action ( ) in the drop down next to it. Shown below these is the code you just entered.
  9. Select File>Save from the menu bar.