To develop a web presentation layer for your Java application,
you can create a dynamic web project.
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
- Create a dynamic web project:
- Click The
New Project wizard opens.
- Expand the Web folder and click Dynamic
Web Project. Other types of web project cannot
run in CICS.
- Complete the fields in the wizard and click Finish to
create the project.
- Update the build path:
- 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
profile in CICS.
- Click to complete adding the library. Click OK to
save your changes.
- 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:
- Right-click the deployment descriptor in the project
and select Generate Deployment Descriptor Stub. This option generates the web.xml file.
- Open the web.xml file by expanding and double clicking the file.
- 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.