The sample application extracts customer information from data tables and
returns it to the user. The sample consists of:
- An HTML form.
- A Java™ servlet, plus JavaServer Pages, running in a J2EE-compliant Web
application server.
- An enterprise bean running on a CICS EJB server.
- Two DB2 data tables containing customer information. One contains account
information such as current balance; the other contains name and address details.
- Two CICS server programs, written in COBOL. The DFH0ACTD program retrieves
information from the accounts data table. The DFH0CSTD program retrieves information
from the name and address data table.
The sample works like this:
- The user starts the application from a Web browser. A form is displayed.
- The form requests a customer number from the user. When the user has entered
a customer number and pressed the SUBMIT button, the servlet is invoked.
- The servlet:
- Looks up a reference to the enterprise bean in the JNDI namespace
- Creates a new remote instance of the enterprise bean in CICS
- Invokes a method on the bean-instance, passing as input the customer number
input by the user
- The enterprise bean uses the Common Connector Interface (CCI) of the CCI Connector for CICS® TS to
link to the CICS COBOL server programs, passing the customer number.
The CCI Connector for CICS TS is
described in The CCI Connector for CICS TS.
- The server programs use the specified number as the key to the DB2 records
for this customer. They retrieve the customer's details from the DB2 data
tables and return the account number, balance, and address to the enterprise
bean.
- The enterprise bean returns the customer's details to the servlet,
which uses a JavaServer Page to display them on the user's browser. If
the customer number is not valid, the browser displays an error page.
Design note: An alternative design would be to
replace the connector code with a JCICS LINK call. The advantage of using
a CCI-compliant connector such as the CCI Connector for CICS TS is that it makes it easier
to port the application between application servers such as WebSphere and
CICS. If portability is not required, a JCICS call would be sufficient.
Figure 1 shows the components of the sample application.
Figure 1. Overview
of the EJB Bank Account sample application.
The main elements of
the sample are a Java servlet, an enterprise bean, two CICS server programs,
and two DB2 data tables. The sample extracts customer details from the data
tables and returns them to the user. In this example, the servlet is running
in a Web application server on a Windows NT server; an LDAP name server is
used. Other configurations are possible. For example, a COS Naming Server
could have been used.