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.

About this task

If you are using the CICS Explorer SDK, you can refer to the CICS Explorer SDK help, which provides full details on how you can complete each of the following steps to develop and package web applications.

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

The

Procedure

  1. Create a web project for your application.
    • If you're using the CICS Explorer SDK, create a dynamic web project and update your build path to add the Liberty libraries. Although you can create other types of web project in Eclipse, CICS® supports only OSGi bundle projects and dynamic web projects.
      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 Liberty JVM server libraries.
      4. Click Next, select the CICS version and click Finish to complete adding the library.
      5. Click OK to save your changes.
    • Start of changeFor 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. End of change
    • Start of changeFor Gradle users, create a Gradle project. In the build.gradle file, specify the following and declare dependencies on CICS-provided artifacts.
      plugins {
          id 'war'
      }
      End of change
  2. Develop your web application. You can use the JCICS API to access CICS services and connect to DB2®. The CICS Explorer SDK includes examples of web components and OSGi bundles that use JCICS and DB2.
  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 CICS Explorer SDK includes a template for this file that contains the correct information for CICS. See Authenticating users in a Liberty JVM server for further information. CICS security uses basic authentication to check the user ID and password in the application request. You can use Liberty security instead, but you must provide your own security roles and basic user registry.
    Warning: If you use RequestDispatcher.forward() methods to forward requests from one servlet to another, the security check occurs only on the first servlet that is requested from the client.
  4. Create one or more CICS bundle projects to package your application. You can add references to OSGi application projects, dynamic web projects, and OSGi bundle projects, and 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.