CS/CIS 330 Spring 2004, Homework 1a:

Tomcat Installation


This assignment is due on
2/9/2004 at 23:59pm via the course management system. You must perform this assignment individually; groups are not permitted.


Project Description

            This handout provides instructions for installing and configuring the Apache Tomcat server program on your laptops.  This assignment teaches you how to setup the software.  Please follow the following instruction to install the newest version of Tomcat 5.   We will be using Tomcat 5.0.18.  To get the installation file, please go to download
à binary à find tomcat 5.xx... then save either the zip or exe file.

 

 

Instructions

 

  1. General Tomcat Installation Instructions Here
  2. Install the Java SDK (Software Developer Kit) (http://java.sun.com/) to C:\JDK
  3. Install the Apache Tomcat Web Software (http://www.apache.org/)
  4. Configure Tomcat to use as the ROOT directory C:\CS330
  5. Install the Microsoft SQL JDBC drivers.  Installation simply requires you to place the Java classes in the appropriate directories.
  6. Using your newly setup server, write a JSP that prints out a table in HTML containing the factorials from 1 to 20, one on each row of the table.  The output should be extremely simple but should be in the form of an HTML table and also nicely formatted.  By looking at the table, we should know 10! = 3628800.  In addition, have it print out the URL string used to call the JSP in a line after the table.

 

For the list, print the numbers using a valid Java for loop.  In this manner, the JSP code should be for this part should really be 1-2 lines long, not 10 lines.  Also, write the header/footer for the table as well as the HTML tags (like <body>,<title>) in HTML, not JSP.  As an example, consider the following code where only the “Hello” statement is written in JSP, the rest is just regular HTML:

 

<HTML>

<BODY>

       <% out.println("Hello"); %>

</BODY>
</HTML>

 

  1. Write a Servlet that accomplishes the same task as your JSP called FactorialList.

 

 

Hints:

 

The way you put java.exe and javac.exe into the path in WindowsXP is the following: Control Panel à Systems à Advanced à Environment Variables à Under System Variables à path à Then, Add the correct Java and javac path(ex: C:\j2sdk\j2sdk1.4.2\bin) into the path.  You have to restart your computer before you can execute javac in command line.

 

 

During Tomcat Installation:

 

  1. HTTP/1.1 Connector Port changes to 80 instead of 8080.  Once changed, you can just use the URL string http://localhost to access your server once live.  By default, you must use http://localhost:8080 to access your server.
  2. Please set a password for admin login
  3. Select the correct path for the Java Virtual Machine (JVM) (Ex: C:\j2sdk\j2sdk1.4.2\  NO bin here).

 

 

Changing the Default Server Path

 

After you finishing testing the server, which is step 3. You can now change application base to C:\CS330 in the following way:

 

  1. Shutdown tomcat if it is running.
  2. Go to the apache tomcat installation directory (ex: C:\Program Files\Apache Software Foundation\Tomcat 5.0)
  3. Copy the whole webapp folder and paste it to c:\CS330.
  4. Now, you have the same structure as the default tomcat. Later on, you can just develop your code or test your code under C:\CS330\webapps\ROOT\.
  5. Look for

 

<Context path="" docBase="c:\CS330\webapps\ROOT" debug="0"/>

 

in Server.xml. Notice the change I have made above(added C:\CS330\webapps\), please make that change in your server.xml file.

  1. Restart Tomcat

 

If you have trouble installing Tomcat, please come to the office hours, we will be more than happy to help you.

 

 

What to Submit

In a zip file called A1a.zip submit: