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

You must have installed the developer tools for the Liberty profile. For more information, see Installing the Liberty profile.

About this task

Support for dynamic web projects is provided by the web developer tools. However, to develop and compile servlets and JSP pages, you must add the correct library to your projects. This library is supplied with the CICS Explorer SDK. You can also use the CICS Explorer SDK to deploy the dynamic web project with the rest of the Java application to run it in CICS.

Procedure

  1. Create a dynamic web project:
    1. Click File > New > Project The New Project wizard opens.
    2. Expand the Web folder and click Dynamic Web Project. Other types of web project cannot run in CICS.
    3. Complete the fields in the wizard and click Finish to create the project.
  2. Update the build path:
    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 profile in CICS.
    4. Click Next > Finish to complete adding the library. Click OK to save your changes.
  3. Optional: To create an application that uses CICS security, create a web.xml file. You can either create an XML file that uses the template CICS SDK for Servlet and JSP web.xml, or generate the web.xml file from the project. To create an XML file from the template, click NewXML file and follow the wizard. To generate the file, follow these steps:
    1. Right-click the deployment descriptor in the project and select Generate Deployment Descriptor Stub. This option generates the web.xml file.
    2. Open the web.xml file by expanding WebContent > WEB-INF and double clicking the file.
    3. To delegate security to CICS, add a security definition. Use the keyboard shortcut Ctrl+Space and keep clicking until you list the XML templates. Select CICS SDK for Servlet and JSP Security Constraint. The template creates a security definition that you can edit for your application:
      <security-constraint>
         <display-name>Application security constraint</display-name>
         <web-resource-collection>
            <web-resource-name>application</web-resource-name>
            <description>Protection area for my web application</description>
            <url-pattern>/*</url-pattern>
         </web-resource-collection>
         <auth-constraint>
           <description>All authenticated users of my application</description>
           <role-name>cicsAllAuthenticated</role-name>
         </auth-constraint>
      </security-constraint>
      <user-data-constraint>
         <transport-guarantee>CONFIDENTIAL</transport-guarantee>
      </user-data-constraint>
      The <display-name> element specifies a short name for the web application that can be displayed by tools. The <web-resource-name> element specifies the application. You can put any values in these elements and the descriptions. Specifying /* in the <url-pattern> element protects every URL in the application.

      The <user-data-constraint> forces the application to use a HTTPS port. If you do not want to use SSL, remove the <user-data-constraint> section.

Results

You have created a dynamic web project and added the servlet libraries to your build path to develop a web project.

What to do next

Develop your web presentation layer and add it to a CICS bundle project for deployment. For more information, see Adding a project to a CICS bundle project.

You can optionally add a URIMAP and TRANSACTION resource for your web application to the bundle project. The URIMAP resource maps inbound requests for the web application to a CICS transaction. Application users are authorized to use the application based on the transaction that is running. For more information, see Creating a URI map and transaction.