|
Tomcat
Installing Tomcat 4.1.18
Tomcat is a free, open-source implementation of Java Servlet and JavaServer
Pages technologies developed under the Jakarta project at the Apache Software
Foundation.
Tomcat 4.1.18 is a web server and supports Servlet 2.3 and JSP 1.2.
It requires JDK 1.2 or later.
I did the following to get Tomcat 4.1.18 installed:
1. Checked JDK requirement. I had JDK 1.3.1 installed on \local\jdk1.3.1.
2. Downloaded tomcat-4.1.18.zip from http://www.apache.inetcosmos.org/dist/jakarta/tomcat-4/binaries/.
3. Unziped tomcat-4.1.18.zip in \local.
4. Started Tomcat server:
cd \local\jakarta-tomcat-4.1.18\bin
set JAVA_HOME=\local\jdk1.3.1
startup
5. Tomcat created a separate command window, on which I got:
[INFO] Registry - -Loading registry information
[INFO] Registry - -Creating new Registry instance
[INFO] Registry - -Creating MBeanServer
[INFO] Http11Protocol - -Initializing Coyote HTTP/1.1 on port 8080
Starting service Tomcat-Standalone
Apache Tomcat/4.1.18
[INFO] Http11Protocol - -Starting Coyote HTTP/1.1 on port 8080
[INFO] ChannelSocket - -JK2: ajp13 listening on 0.0.0.0/0.0.0.0:8009
[INFO] JkMain - -Jk running ID=0 time=30/130 config=C:\local\jakarta-
tomcat-4.1.18\bin\..\conf\jk2.properties
6. Ran Internet Explorer (IE) with url: http://localhost:8080. I got the Tomcat
home page with the following message on it:
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-4.1.18\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-4.1.18\webapps\ROOT
To change the port number, you need to edit \local\jakarta-tomcat-4.1.18\conf\server.xml.
"Hello world!" Example
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-4.1.18\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.
|