JSP Client

Restriction: This topic applies only when the Enterprise Server feature is enabled.

For an EJB to access a COBOL service running on an enterprise server instance, you must have the EJB and a JSP client running on an application server. You can generate both an EJB and a JSP client from the IMTK simultaneously, and then configure your application server to run them.

Important: During the generation process, the .car file that was created during deployment is deleted. Therefore, when setting up your Java service interface for production, you must deploy the .car file to Enterprise Server before generating a client. See Service Interface Deployment Methods and Service Interface Deployment Package for more information.

The generated EJB and JSP client are packaged into archive files (.jar, .war, and .ear), together with manifest files and deployment descriptors. These files are located in the structure under your project's myService.deploy directory, where myService is the name of your service interface. You can view the contents of and/or extract individual files from these archives using the jar command or a zip utility. The following archive files are created:

EJB Jar Archive
The myService.jar archive contains the EJB classes and additional required files:
ejb-jar.xml Generic deployment descriptor, defining the EJB
myServiceBean.class Bean class for the EJB
myServiceHome.class Home interface for the EJB
myService.class Remote interface for the EJB
myRecord.class custom record, if needed by the EJB
manifest.mf Manifest describing this .jar file
*.xml, such as weblogic-ejb-jar.xml For some Java application servers (such as WebLogic), a deployment descriptor for deploying the EJB to that application server

The source code for the EJB classes are generated in the directory com\mypackage\myService.

Client War Archive
The myService.war archive contains the JSP class files and other required files:
*.jsp JSP files. These pass data back and forth between the end user and the servlet.
myServiceJspBean.class This file contains the getter and setter methods that are used to move information back and forth between the servlet and JSP.
myServiceServlet.class This file is the servlet. It processes the incoming requests from the JSP, invokes an instance of the stateless EJB, and forwards the response back to the JSP.
myServiceSessionMonitor.class This is a helper class, which stores the EJB instances for the stateful session bean.
manifest.mf Manifest describing this .war file
mfejlib.jar .. custom records
web.xml Generic deployment descriptor, defining the client servlet and the EJB reference
*.xml, such as weblogic.xml For some Java application servers (such as WebLogic), a deployment descriptor for deploying the .war file to that application server
Application Ear Archive
The myService.ear archive contains the other two archive files and additional required files. This archive contains everything you need to deploy the EJB to supported third-party application servers, without further changes.
Attention: You must deploy this .ear file to your Java application server.
application.xml Generic deployment descriptor, defining the .jar and the client .war files
myService.jar EJB Jar archive file
myService.war Client War archive file
manifest.mf Manifest describing this .jar file
mfejlib.jar Custom records

Editing a JSP client component

To enhance its appearance and usability, you can optionally edit a JSP client. Before attempting to do so, you should first extract the JSP file from the myService.war archive file found in the deployment folder for your project.

Note: If you edit the JSP file, add it back to the .war archive and save a copy of it to another location to ensure it does not get overwritten if you decide to redeploy the service interface.

Running a JSP client

  • The enterprise server instance is started
  • Your service interface is deployed to the enterprise server instance.
  • The generated .ear file is deployed to your Java application server.
  • You have defined a COBOL Enterprise Server Debug Configuration that specifies the following:
    • The project that contains your service interface (.svi) file
    • The enterprise server instance configured to run the service
    • That the debugging type that corresponds to the type of service is configured properly
  • The COBOL application is started in the Debugger
Note: If you are using an unsupported Java application server, you need to create deployment descriptors manually. See your application server documentation for more information. For a list of supported application servers, see the Application Server JCA support for Enterprise Server section in the Additional Software Requirements on Windows topic. See also To Create Deployment Descriptors Manually for further instructions.