Creating the servlet examples

Create one or more servlet examples to understand how to develop dynamic web projects and OSGi bundles that can run in CICS®.

About this task

Each example is complete and ready to deploy to a JVM server that is running in CICS. The examples demonstrate best practice, and show you how to develop an application that can access DB2® from CICS and a temporary storage queue.

Procedure

  1. In the CICS Explorer® SDK, open the Java™ perspective.
  2. Set the target platform to the latest release of CICS to work with the servlet projects.
    Otherwise compilation errors can occur when you create the examples in your workspace.
    1. Click Window > Preferences from the workbench menu bar.
    2. Expand Plug-in Development and click Target Platform.
    3. Click Add to create a target definition.
    4. Click the Template radio button and select CICS TS V5.2 with Liberty and PHP from the list.
    5. Click Next in the wizard and then click Finish.
    6. Select the target definition and click OK.
  3. To create an example, use one of the following methods to open the New Example wizard:
    • In the Eclipse menu bar, click File > New > Example.
    • Click the down arrow on the New Wizard icon and click Example.
    • In the Project Explorer view, right-click and click New > Example.
  4. In the CICS Examples > Servlet and JSP folder, select the example that you would like to use.
    You can select from the following examples:
    • CICS Hello World
    • CICS Java Database Connectivity (JDBC)
    • CICS Temporary Storage Queue (TSQ)
  5. Click Next.
    The names of all the projects that will be created for the selected example are listed.
  6. Click Finish.

    The wizard creates the appropriate projects for the example you selected. For example, if you selected CICS Temporary Storage Queue (TSQ) or CICS Java Database Connectivity (JDBC), the wizard creates an enterprise bundle archive (EBA) file, which contains a WAB file and OSGI bundles. The wizard also creates a CICS bundle project that references the EBA file.

    Tip: If the project does not build and the following error occurs, ensure that you completed step 2 successfully:
    Bundle 'com.ibm.cics.server' cannot be resolved

Results

The example project is created in the Project Explorer.