JSP and JSTL Tutorials - Herong's Tutorial Notes
Dr. Herong Yang, Version 3.09, 2006

Tomcat 5.5.4

JSP/JSTL Tutorials - Herong's Tutorial Notes © Dr. Herong Yang

Using Cookies

Using JavaBean Classes

HTTP Response Header Lines

Non ASCII Characters

JSTL and Expression Language

File Upload

Execution Context

JSP Elements

JSP Standard Tag Libraries (JSTL)

JSP Custom Tag

... Table of Contents

Installing Tomcat 5.5.4

Tomcat 5.5.4 is a Web server and supports Servlet 2.4 and JSP 2.0. It requires JDK 1.5 or later. I did the following to get Tomcat 5.5.4 installed:

1. Checked JDK requirement. I had JDK 1.5.0 installed on \local\j2sdk1.5.0.

2. Downloaded jakarta-tomcat-5.5.4.zip from http://jakarta.apache.org/tomcat.

3. Unziped jakarta-tomcat-5.5.4.zip in \local.

4. Started Tomcat server:

cd \local\jakarta-tomcat-5.5.4\bin
set JAVA_HOME=\local\j2sdk1.5.0
startup

5. Tomcat created a separate command window, on which I got:

(Date) 9:47:16 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
(Date) 9:47:17 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 5407 ms
(Date) 9:47:17 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
(Date) 9:47:17 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.4
......

6. Ran Internet Explorer (IE) with url: http://localhost:8080. I got the Tomcat home page with the following message on it:

Apache Tomcat/5.5.4 If you're seeing this page via a web browser, it means you've setup Tomcat successfully. Congratulations!

Using Tomcat as a Web Server

To find out where it document root directory of this Web server, let's create hello.html:

<html><body>Hello world!</body></html>

Then save hello.html to \local\jakarta-tomcat-5.5.4\webapps\ROOT. Now, run IE with url: http://localhost:8080/hello.html. You should see "Hello world!" in the IE window.

Now, we know that the Web server:

Listening on port: 8080
Serving document from: \local\jakarta-tomcat-5.5.4\webapps\ROOT

To change the port number, you need to edit \local\jakarta-tomcat-5.5.4\conf\server.xml.

"Hello world!" Example in JSP

To verify if Tomcat supports JSP or not, let's create hello.jsp:

<html><body>
<% out.println("Hello world!"); %>
</body></html>

Then save hello.jsp to \local\jakarta-tomcat-5.5.4\webapps\ROOT. Now, ran IE with url: http://localhost:8080/hello.jsp. You should see "Hello world!" in the IE window.

Congratulations! I have successfully served an JSP page through Tomcat.

Dr. Herong Yang, updated in 2006
JSP and JSTL Tutorials - Herong's Tutorial Notes - Tomcat 5.5.4