Generating the JSP files for a Web interaction

You can use the iSeries Web Interaction wizard to generate the JSP files for you. The JSP files are the Web pages used in your Web application. The wizard also adds iSeries Web components (fields and controls), to those files, and generates the iSeries run-time classes used to communicate with your business processes.

To open the Web Interaction wizard, select the Web project folder, then click the Create or Modify a Web interaction icon Toolbar icon for Create or Modify a Web interaction. on the toolbar. If you have not defined run-time information in the iSeries Web Tools Run-time Configuration wizard, you will receive a warning message in the first page of the Web Interaction wizard.

As you progress through the Web Interaction wizard, the options you select determine which pages of the wizard are displayed.

When you want the wizard to generate the JSP files for you, the pages you work with are:
  1. Specify a Name and Location for your Web Interaction
  2. Specify the Input and Output Pages for your Web Interaction
  3. One of:
    1. Specify the Input and Output Parameters for your iSeries Host Program
    2. Choose the Java Bean and Methods to Invoke
  4. Design the Input Form
  5. Design the Result Form
  6. Specify flow controller information page (for multiple output pages)
  7. Specify a Page Template (if you choose to use a page template)

The following information describes how to complete the wizard pages:

  1. Specify a Name and Location for your Web Interaction

    See Interaction name and location for descriptions of the fields on this page of the wizard.

    1. The Destination folder defaults to the Web content folder in your Web project. You can use the Browse button to select another folder, but it must be within the Web content folder.
    2. Enter a name for your Web interaction in the Web Interaction name field.
    3. The Java package prefix is com.ibm followed by your Web project name. The action classes and form beans generated by the Web Interaction wizard are organized in package names that use this prefix and include .actions and .forms as the suffix on the package name. (For example, if the Java package prefix is com.ibm.cust, the package created for the action classes is com.ibm.cust.actions.) You can change this package prefix, and the Web Interaction wizard uses the new prefix when it creates the packages.
    4. By default, the Use error page option is selected. This option indicates that the error.jsp file that is copied into your Web project by the wizard, is used to display run-time errors that occur when you run your Web application.
    5. You can select the Invalidate session after the interaction occurs option if this is the last interaction. The program or procedure can then preform any clean up operations that are required. When the program or procedure ends, then the session is invalidated and the iSeries job ends.
    6. Select Terminate iSeries connection to terminate the connection to the iSeries system after the interaction occurs. This option and Invalidate session after the interaction occurs are mutually exclusive. If you select one, you cannot select the other.
    7. Click Next to proceed to the next page in the wizard.
  2. Specify the Input and Output Pages for your Web Interaction

    See Input and output pages for descriptions of the fields and controls on this page of the wizard.

    1. Select Generate input JSP and Generate output JSP.
    2. Also select Generate input/output pages using a page template to indicate that you want to apply a page template to the files being created by the wizard.
    3. Click Next to proceed to Specify the Input and Output Parameters for your iSeries Host Program.
  3. Specify the Input and Output Parameters for your iSeries Host Program

    See iSeries program or procedure for descriptions of the fields and controls on this page of the wizard.

    1. The Use an iSeries program or procedure radio button is selected when you reach this page in the wizard. If you select the Use Java bean and Methods radio button, the page changes to a different set of options. See Choose the Java Bean and Methods to Invoke for information about selecting the options on this page.
    2. By default, the Add Program fields are shown.
      1. Use the Add Program fields on this page in the wizard to define the name and location of the program object or service program object that performs the business logic for the Web interaction. See Add program for descriptions of the fields and controls that you can use on this page.
    3. When you complete the definition of your program or service program, click OK to add the program definition to the Program call definitions area of the page. When you click OK the Add Parameter fields are automatically displayed.
    4. Use the Add Parameter fields on this page in the wizard to identify the parameters that are in your program or service program. If the program or service program has not been created, these are the parameters that you intend to include in the program or service program. See Add parameter for descriptions of the fields and controls that you can use on this page.
    5. After you complete the definitions for a parameter, click OK to add the parameter definition to the program in the Program call definitions area. The Add Parameter fields are cleared and are available for another parameter definition.
    6. Use the Add Structure fields on this page in the wizard to define a structure that you can use with your program or service program call definition. See Add structure for descriptions of the fields and controls that you can use on this page.

      You can explicitly add parameters to the structure, or you can add parameters to a structure from fields defined within records on an iSeries host, see Populating a structure with field definitions.

    7. Click OK to add the structure definition to the Program call definitions area on this page of the wizard.
    8. To add the structure to your program definition:
      1. Select the program name in the Program call definitions area and click Add Parameter.
      2. Enter a parameter name that represents the structure.
      3. Select structure in the Data type list, and click OK to add the structure to your program definition.
  4. Choose the Java Bean and Methods to Invoke

    This page opens in the wizard when you select the Use a Java bean radio button instead of the Use an iSeries program or procedure radio button.

    See Java bean and methods for descriptions of the fields and controls on this page of the wizard.

    1. Click Browse to open the Choose Java bean window, and begin typing the name of a Java bean in the top field. As you type, the Matching types field is populated with the Java bean names that correspond to your input.
    2. Select the Java bean that you want to use and click OK to add it to the Bean field and to list the properties and methods for the bean in the field.
    3. Select the properties and methods that you want to use for the business logic in this interaction and click Next to open the Design the Input Form page of the wizard.
  5. Design the Input Form

    See The input form for descriptions of the fields and controls on this page of the wizard.

    This page contains an input parameters area, a property values area with Page and Fields tabs, and a preview area.

    1. All the parameters that you specified as input and output, or input only, for the program or service program are shown in the input parameters area. If you specified a Java bean for your interaction, then the Java bean methods and properties that you selected appear in the input parameters area. Clear any of the check boxes for any of the parameters that you want to exclude from the input page that is to be generated.
    2. Click Next to proceed to Design the Result Form.
  6. Design the Result Form

    See The result form for descriptions of the fields and controls on this page of the wizard.

    This page contains an output parameters area, a property values area with Page and Fields tabs, and a preview area.

    1. All of the parameters that you specified as input and output, or output only, are shown in the Output parameters area. If you specified a Java bean for your interaction, the Java bean methods and properties you selected appear in the Output parameters area. All of the parameters are selected for inclusion on the page that the wizard will generate. Clear any of the check boxes for any of the parameters that you want to exclude from the output page that is to be generated.
  7. Click Next to proceed to the Specify a Page Template page.
  8. Specify a Page Template

    There are three pages related to specifying a page template that appear in the wizard when you select Generate input page, Generate output page, and then select the check box Generate input/output pages using the page template. The pages are:

    • Specify a Page Template
    • Map Page Elements to the Page Template
    • Select Web Pages

    See Page template for descriptions of the fields and controls on these pages of the wizard.

    1. Select the User-Defined Page Template radio button on the Specify a Page Template page, and in the Thumbnail area on the page select the page template that you created.
    2. Click Next to open the page Map Page Elements to the Page Template. This page shows how the content areas in the page template are mapped to page elements in the JSP files that will be generated. If you created more that one content area when you created your page template, you use this page to indicate how these content areas are mapped to various page elements.
    3. Click Next to open the page Select Web Pages. This page of the wizard shows the JSP pages that will be generated. By default, all of the pages are selected to have the page template applied to them. Clear the check box for any page that you do not want the template applied to.
    4. Click Validate All Pages to determine if the page template can be applied.
    5. Click Show Error Pages to identify any JSP files that the template cannot be used with.
  9. Create the Web interaction
    1. Click Finish to create the Web interaction, the JSP files, the iSeries Web components within the files, and the iSeries run-time classes used to communicate with the program, procedure, or Java bean method and properties.
    Tip: Each Web interaction is represented by a .wit file in your Web project. To modify a Web interaction, double-click the .wit file to open the Web Interaction wizard and modify the settings for the interaction.
    Restriction: The names of the PCML file and the MPCML file generated by the Web Interaction wizard are the same as the Web project name. For example, if the Web project name is myproj, then the PCML file that is generated is myproj.pcml. Similarly, the name of the MPCML file is myproj.mpcml.
    • If you create a new Web project and then import all of the files, including the PCML and MPCML files, from another Web project, the name of the PCML and MPCML files no longer match the name of the new Web project. As a result, the Web application fails to run correctly. You must rename the PCML and MPCML files to match the Web project name to resolve this problem.
    • If you rename an existing Web project, be sure to rename the PCML and the MPCML files to match the new Web project name.