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 Red Hat JBoss Middleware, and select Red Hat JBoss Enterprise Application Platform 7.1 Runtime.
      • IBM - Select WebSphere Application Server v8.5 or later.
      • Oracle - Select Oracle WebLogic Server 12.1.1 or later.
    3. In the Home Directory (or Tomcat installation 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. In the Project Explorer, right-click the JSPBookDemo project, and then click Properties.
  2. Click Java Build Path, and then click the Projects tab.
  3. In the Required projects on the build path list, click Classpath.
  4. Click Add.

    This opens the Required Project Selection dialog box.

  5. Check the CobolBook project, and then click OK.
  6. Click the Libraries tab.
  7. In the JARs and class folders on the build path list, click Classpath.
  8. Click Add Library.

    This opens the Add Library dialog box.

  9. Click COBOL JVM Runtime System, and then click Next
  10. Click Finish.
  11. Click Apply.
  12. While you are still in the properties for JSPBookDemo, click Deployment Assembly.
  13. Click Add, then select Project, and click Next.
  14. On the next page click CobolBook, and then click Finish.

    This adds an entry to the Web Deployment Assembly list to indicate that the CobolBook project classes are included in the WEB-INF/lib directory of the Web archive. The project is also built.

  15. Click Add, then select Java Build Path Entries, and then click Next.
  16. On the next page, select COBOL JVM Runtime System, and then click Finish.
  17. Click Apply and Close 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.