Creating a Dynamic Web Project

To develop a web presentation layer for your Java™ application, you can create a Dynamic Web Project.

Before you begin

Ensure that you have set up the development environment.

A restriction added by Liberty and introduced by an APAR applied to CICS TS V5.1, prevents access to OSGi bundles from servlets that are deployed in a WAR file. The restriction includes access to OSGi bundles installed directly in a CICS bundle. To overcome this restriction, you must deploy your application as a WAB, as part of an EBA (OSGi Application Project). An EBA is a container in which web and OSGi components can interact.

About this task

If you are using the IBM CICS SDK for Java or IBM CICS SDK for Java EE, Jakarta EE and Liberty preinstalled in CICS Explorer® (as shown in the following instructions) or IBM Developer for z/OS (IDz), you can refer to the CICS Explorer and IBM CICS SDK for Java help, which provides full details on how you can complete each of the following steps to develop and package web applications.

If you are using a build toolchain such as Maven or Gradle, you can use CICS-provided artifacts on Maven Central to define Java dependencies.

Procedure

  1. Create a web project for your application.
    • CICS Explorer If you're using CICS Explorer, create a Dynamic Web Project and update your build path to add the Liberty libraries.
      1. Right-click the Dynamic Web Project and click Build Path > Configure Build Path. The properties dialog opens for the project.
      2. In the Java Build Path, click the Libraries tab.
      3. Click Add Library and select CICS with Java EE, Jakarta EE and Liberty.
      4. Click Next, select the CICS version, then click Finish to complete adding the library.
      5. Click OK to save your changes.
    • Gradle For Gradle users, create a Gradle project. In the build.gradle file, specify the following and declare dependencies on CICS-provided artifacts.
      plugins {
          id 'war'
      }
    • Maven For Maven users, create a Maven project. In the pom.xml file, specify <packaging>war</packaging> and declare dependencies on CICS-provided artifacts. If you are unfamiliar with Maven, you can start with the maven-archetype-webapp archetype and modify it.
  2. Develop your web application. You can use the JCICS API to access CICS services, JDBC to access DB2® and JMS to access IBM MQ. The IBM CICS SDK for Java EE, Jakarta EE and Liberty includes examples of web components that use JCICS and JDBC.
  3. Optional: If you want to secure the application with CICS security, create a web.xml file in the Dynamic Web Project to contain a CICS security constraint. The IBM CICS SDK for Java EE, Jakarta EE and Liberty includes a template for this file that contains the correct information for CICS. See Authenticating users in a Liberty JVM server for further information.
  4. Create one or more CICS bundle projects to package your application. Add definitions and imports for CICS resources. Each CICS bundle contains an ID and version so you can manage changes in a granular way.
  5. Optional: Add a URIMAP and TRANSACTION resource to a CICS bundle if you want to map inbound web requests from a URI to run under a specific transaction. If you do not define these resources, all work runs under a supplied transaction, which is called CJSA. These resources are installed dynamically and managed as part of the bundle in CICS.

Results

You set up your development environment, created a web application from a Dynamic Web Project, and packaged it for deployment.

What to do next

When you are ready to deploy your application, export the CICS bundle projects to zFS. The referenced projects are built and included in the transfer to zFS. Alternatively, you can follow the Liberty deployment model by exporting the application as a WAR and deploying it to the dropins directory of a running Liberty JVM server.