Exercise 3.5: Creating another Web interaction

Before you begin, you must complete Exercise 3.4: Linking to the customer list page.

Next you create another Web interaction to use the new input page and output pages that you just created.

To create another Web interaction:

  1. Locate your project WSSLABxx in the Project Explorer.
    Project Explorer
  2. Right-click on your project and click New > Other on the pop-up menu.
    Selecting New > Other

    The Select page opens.
    New dialog

  3. In the left pane of the Select page, select Web.
  4. In the right pane of the Select page, select Web Interaction.
  5. Click Next.

    The Web Interaction wizard opens.
    Web Interaction Wizard

  6. In the Web Interaction name field, type getCustNumber.
  7. Click Next.

    As you probably remember from the previous tutorial, this next page is where you specify the input and output pages.
    Input and Output page definition

  8. Leave the Use input pages radio button selected and click Add.
  9. Select custList.jsp on the Input page dialog. Click OK.

    This is the subfile that contains the list of customers. It is the input page because from here you fill the customer number field with data from the selected table record.

  10. Leave the Use output pages radio button selected and click Add.
  11. Select inquiry.jsp on the Output JSP dialog. Click OK.
  12. Click Next.

    You have now defined your input and output pages.

Adding an iSeries ILE program to the interaction

Note:
Some screens in this section will look different if you choose to use the GETDATAS service program instead of the GETDATA program to handle the Web interaction.

Next you will select the RPG service program you will use to handle your Web interaction.
Defining an iSeries ILE program

To add a program to the Web interaction:

  1. Leave the Use an iSeries program or procedure radio button selected.
  2. Click Add Program.
  3. Click Browse to browse for the service program you will use.

    If you don't see your connection then you will need to create a connection.

    Follow the steps under the next section called Creating a connection.

    If you do see your connection then skip the next section and proceed to the section Selecting the service program.

Creating a connection

To create a connection:

  1. In the list in the left pane, expand the New Connection list item by clicking on the plus sign + beside its icon.

    The Name personal profile page opens.

  2. Accept the default profile. Click Next.

    The Remote iSeries System Connection page opens.
    New Connection dialog

  3. Leave the default value for the Parent Profile field.
  4. In the Host Name field, type the name of the iSeries server (Same server name as you specified for the runtime).
  5. Click Finish to create a connection.

Selecting the service program

Now you select the RPG service program.

  1. Expand your connection.
  2. Expand *LIBL.
  3. If you see a sign-on dialog, type your user ID and password.
  4. If you don't see the WSSLABxx library, click Work with libraries and type WSSLABxx in the dialog, then click OK.
  5. Expand the WSSLABxx library and select the WDSCSRV service program.
    Selecting the RPG service program
  6. Click OK.

    Most of the fields have now been filled in for you. However you must fill in the values for the program alias and entry point fields.
    Filling the Program parameters

  7. In the Program alias field, type getCustNumber.
  8. In the Entry point field, type readc (case sensitive).
  9. Click OK.

Adding a parameter

Let's add a parameter to the service program interface definition that you just added. You might remember the procedure readc returns the customer number as a parameter.

To add a parameter:

  1. Under Program call definitions, select the getCustNumber program.
  2. Click Add Parameter.
  3. In the Parameter name field, type cnumber.
  4. Leave character in the Data type list selected
  5. In the Length field, type 7.
  6. Select Output from the Usage list.

    Your wizard should now look like this:
    Adding the structure as a parameter to the service program

  7. Click OK.

    You have finished adding program parameters. Now you need to define the binding between the output parameter and the customer number field on the inquiry page.

  8. Click Next.
    Linking parameters
  9. You have no input parameters, so you don't need to modify this page.
  10. Click Next again.
  11. Under Output parameters, select cnumber.
    Linking parameters
  12. Under Output page fields, expand /inquiry.jsp > FORM:myForm > Simple Table and select CUSTNOI.
  13. Click Link in the middle of the page.
  14. Click Finish to link the output field to the output parameter.

    This tells the wizard to generate code to move the data from the parameter cnumber to the customer number field on the inquiry page.

You have created an iSeries connection, selected the service program, added an output parameter and mapped an output parameter to an output field.

Module recap

You have completed Module 3. Creating the customer list input page. You have learned how to:

Now that you have created a new input page from a subfile, linked that new input page to the customer inquiry input page and added the iSeries business logic (service program) and additional parameter to the existing Web application in order to process the request to get a customer number, you are ready to begin Module 4. Creating the update record output page.