Creating the Dynamic Web Project

Create a new project

As you will be using features such as servlets and JSP files in this tutorial, you need to create a dynamic web project to contain these resources. This is in contrast to a static web project that does not contain any dynamic content.

  1. Click File > New > Other.
  2. Expand the Web node and select Dynamic Web Project. Click Next.
  3. Enter JSPBookDemo in the Project name field.
  4. Ensure Use default location is selected.
  5. In the Target runtime field, either select an already existing servlet container runtime, or, if you have <None> showing, set one up as follows:
    1. Click New Runtime.
    2. You now need to choose the runtime of the Java servlet that you installed previously, then click Next:
      • Tomcat - Expand Apache, and select Apache Tomcat v7.0
      • JBoss - Expand JBoss Community, and select JBoss 7.1 Runtime
      • IBM - Select WebSphere Application Server v8.5 or later
      • Oracle - Select Oracle WebLogic Server 12c or later
    3. In the Home Directory field, click Browse and choose the location where you installed the servlet for Apache Tomcat, JBoss or IBM WebSphere, or enter the installation path for Oracle WebLogic.
    4. For Apache Tomcat or IBM WebSphere, select an appropriate JRE (usually the same one as the project).
    5. Click Finish.
  6. Set the Dynamic web module version to 2.5.
  7. Click Finish.

    Open the Java EE perspective if prompted to do so; all commands involving JSPBookDemo will be expected in the Java EE perspective.

Add appropriate references to the JVM COBOL project

You need to add a reference to the COBOL project in both the build options, so that the Java compiler can find the appropriate classes to build against, and in the deployment assembly, so that the JVM COBOL program will be exported into the created Web archive. To do this:

  1. Right-click the JSPBookDemo project, and click Properties.
  2. Select Java Build Path and click the Projects tab.
  3. Click Add, check the CobolBook project and click OK.
  4. Open the Libraries tab.
  5. Click Add Library, select COBOL JVM Runtime System, click Next, and finally click Finish.
  6. While you are still in the properties for JSPBookDemo, click Deployment Assembly. In response to Setting Java Build Path click Apply.
  7. Click Add, then select Project, and click Next.
  8. On the next page select CobolBook and click Finish. This adds an entry to the Web Deployment Assembly list to indicate that the CobolBook project classes will be included in the WEB-INF/lib directory of the Web archive. The project is also built.
  9. Click Add, then select Java Build Path Entries, and click Next.
  10. On the next page, select COBOL JVM Runtime System and click Finish.
  11. Click OK to exit the project's properties dialog box. Once again, the project is built.

With these steps you created a dynamic Web project that incorporates your COBOL project.