Assemble the application: Assemble the Web module

A Web module can contain JAR, HTML, or graphic files that your application uses. The HitCount sample application requires the packaging of the JSP file, the servlet, and an XML descriptor into the Web module. To create a Web module, perform the following steps:

  1. Start the application assembly tool. On your workstation, select Start --> Programs -> IBM Websphere -> Application Server v5.0 -> Application Assembly Tool.

    Note: If you already have the application assembly tool open, select the File -> New -> Web Module menu item.

  2. The Welcome to the Application Assembly Tool window is displayed. On the New tab, click Web Module, and click OK.

    The application assembly tool uses a navigation bar to access various parts of the interface. The Web module file has a default name and directory structure and contains general Web module information.

  3. Add the general Web module information.

    • On the General tab, specify HitCount in the Display Name field.
    • On the IBM Extensions tab, check Precompile JSP to obtain better runtime performance.
    • Click Apply.

  4. Add the files needed in the Web module.

    • Expand Files in the navigation bar, right-click Class Files, and select Add Files.
    • In the Add Files window, click Browse next to the Root Directory or Archive field.
    • In the window that appears, select HitCount.jar, and click Select.
    • In the Add Files window, select HitCount.class from the list, and click Add.
    • Click OK.
    • Expand Files in the navigation bar, right-click Resource Files, and select Add Files.
    • In the Add Files window, click Browse next to the Root Directory or Archive field.
    • In the window that appears, select HitCount.jar, and click Select.
    • In the Add Files window, select HitCount.jsp from the list, and click Add.
    • Click OK.

  5. Add the Web components.

    • In the navigation bar, right-click Web Components, and click New.
    • On the General tab, specify HitCount in the Component name field.
    • Specify HitCount in the Display name field.
    • Optionally, you can specify a description of the WAR file in the Description field.
    • On the General tab, select Servlet, and click Browse.
    • Expand the WEB-INF folder, and select classes.
    • Select HitCount.class.
    • Click OK.
    • Click OK to save your changes.

  6. Add the servlet mapping. The servlet mapping value becomes a part of the URL that is used to access the application once it has been assembled and deployed. For example: http://your.server.name:port/hc/hitcount.

    • In the navigation bar, right-click Servlet Mapping, and click New.
    • Specify /hitcount in the URL pattern field.
    • Make sure HitCount is specified in the Servlet field.
    • Click OK.

  7. Add the EJB references.

    • In the navigation bar, right-click EJB References, and click New.
    • On the General tab, specify Increment in the Name field.
    • Optionally, you can specify a description in the Description field.
    • Click Browse next to the Home field.
    • Click Browse again to navigate to the file Increment.jar.

      Note: The file resides in the hcsample folder you created on your iSeries server.

    • Select Increment.jar, and click Select.
    • Navigate to the defaultapplication folder (located in the /com/ibm/ directory structure), and select IncrementHome.class.
    • Click OK.
    • Click Browse next to the Remote field.
    • Click Browse again to navigate to Increment.jar.

      Note: The file resides in the hcsample folder you created on your iSeries server.

    • Select Increment.jar, and click Select.
    • Navigate to the defaultapplication folder, select Increment.class, and click OK.
    • On the Bindings tab, specify Increment in the JNDI name field.
    • Click OK.
    • Click OK to return to the main window.

  8. Save your Web module.

    • Select the File -> Save menu item to save your Web module in the hcsample folder.
    • Save your Web module as HitCount.war.
    • Click OK.

  9. Select the File -> Close menu item to close the file.

Continue Next: Assemble the application into an Enterprise Archive file