CSC 336 Communications and Networking II Lab: Install Tomcat Web Server & Dynamic Web Page Generation Themes: Tomcat, HTML, JavaScript

coldwaterphewΔιακομιστές

17 Νοε 2013 (πριν από 3 χρόνια και 6 μήνες)

89 εμφανίσεις


1

CSC
336

Communications and Networking II

Lab: Install Tomcat Web Server &
Dynamic Web Page Generation

Themes:
Tomcat, HTML,
JavaScript


1.

Install

Apache Tomcat


the web server

You will receive a file with the name apache
-
tomcat.
7.0.8
.zip.
(Optionally, you
c
an download it from
http://tomcat.apache.org/download
-
70.cgi#7.0.8
.)

2.

Then
, you need to set
up
several environment variables.
(To use a startup file,
skip steps a
-

g)

a.

The way to set up th
e environment variables requires: (1) Click the
Start>Control Panel>System (2) Click the Advance Tab (3) Click the
Environment Variables at the bottom of the window (4) Choose the top
window “User Variables” for your changes (5
)
Click the JAVA_HOME (if
any
) and then click the option button

“EDIT”

or
simply click
the
“New”
button
to create one
.

You will see two small windows for setting up the
environment variables.
You will use the top one labeled as the “User
Variables” for the following steps.

b.

Add
JAVA_HO
ME=c:
\
Program Files
\
Java
\
jdk
1.6.0_20
\

c.

Change the original “Path”

to add the following value at the beginning:

PATH=
.;
c:
\
Program Files
\
Java
\
jdk
1.6.0_20
\
bin
\
;c:
\
Program
Files
\
Java
\
jdk
1.6.0_20
\
jre
\
bin
\
; (all in one line)

d.

Add

CATALINA_HOME=c:
\
apache
-
to
mcat
-
7.0.8

e.

Change the original “Classpath”

to add the following at the beginning of the
following:

CLASSPATH=

.;
c:
\
apache
-
tomcat
-
7.0.8
\
lib
\
servlet
-
api.jar
;

f.

After you complete this, you need to click OK three times
to back out.

g.

O
pen a NEW command promp
t wi
ndow and enter “set” again to view the new
setup.

Click Here


2

h.

Download the StartUp file from D2L and modify the file to point to the
wherever you store the apache
-
tomcat
-
7.0.8 folder.

i.

Bring up a Command Prompt window and execute the start up file StartUp.
You may need

to change it to StartUp.bat and then execute it by entering the
name.

3.

To test your installation, you should start Tomcat by
opening a command prompt
window and enter the command
%CATALINA_HOME%
\
bin
\
startup (the batch
file) and clicking on the icon. Then
you should bring up a Web browser and enter
http://localhost:8080/index.jsp
. You should see the screen as in Figure 1 to be
displayed on your browser window. If you don’t, you need to check the
environment variables.


Figure
1

Te
st

your Tomcat installation.

4.

You can now
download the html file test.h
tml from the Course Notes of your

D2L

account.
First, create a folder c:
\
apache
-
tomcat
-
6.0.24
\
webapps
\
HTML and store
this file

as test.html
. This file is a web page source file.


5.

Open a
Web Browser, a Web client,
and enter the web page address:

http://localhost:8080/
HTML/
test.html
.

6.

The client
-
server architecture is the fundamental base of all web applications
running on the Internet. The se
rver programs must be executed prior to the
execution of any client programs. For example, an e
-
mail client requires an e
-
mail
server to be up and running prior to the start of the client; a web client requires a
web server to be up and running when the we
b address is entered.

7.

The purpose to install the Tomcat server on your local machine is to be able to
test/learn HTML or Javascript programming without using another machine to run
the Web server. That’
s

the advantage of installing a Tomcat server on your
local
machine.