To develop a web presentation layer for your Java™ application, you can create a dynamic web
project.
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.
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.
The
Procedure
- 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.
- Right click the dynamic web project and click . The properties dialog opens for the project.
- In the Java Build Path, click the
Libraries tab.
- Click Add Library and select Liberty JVM server libraries.
- Click Next, select the CICS
version and click Finish to complete adding the library.
- Click OK to save your changes.
- 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.
- 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'
}
- 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.
- 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.
- 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.
- 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.