Saturday, October 31, 2009

Installing Tomcat






















 Print  
 E-Mail
 
 Add
Note    Add
Bookmark
   














JSTL:
JSP Standard Tag Library Kick Start
By
Jeff Heaton

Table
of Contents
Appendix B.  Installing JSTL
and Tomcat









Installing Tomcat


JSTL requires JSP pages to execute. To
execute JSP pages, you must have a JSP-compatible Web server
installed on your system. JSTL should work with any JSP 1.2 or
higher Web server. The Web server we use in this book is the
Apache Tomcat Web server. In this section, we show you how to
install Tomcat.


The examples in this book were tested with
Apache Tomcat v4.0.3. We recommend that you use at least this
version of Tomcat. Before you install Tomcat, it is absolutely
essential that you have the JDK installed. Refer to the
previous section for more information on installing the
JDK.


You can download the Tomcat Web server from
the Apache Web site at http://jakarta.apache.org/tomcat/. When you
begin the download, you'll notice that several versions are
available. If you are using Windows, you can choose between a
light (LE) and a full version. Both versions are meant to
function exactly the same. The only difference is that the LE
version does not include some of the JAR files normally
included with JDK 1.4, such as for XML processing. The result
is that if you are using JDK 1.4, you can choose the LE
version and not have to download JAR files that you already
have. The safest route is usually just to install the full
(non-LE) version.


Once you download Tomcat, you should have a
file named Jakarta-tomcat-4.0.3.exe. This file, when executed,
functions as the installer for the Tomcat Web server. To begin
the installation, execute Jakarta-tomcat-4.0.3.exe. Once the
Tomcat installation program begins, you see a window that
looks like the one shown in Figure
B.1.



Figure B.1.
Installing Apache Tomcat.


The first thing that the installation program
will do is attempt to locate your JDK installed path. If the
program finds a valid JDK, it displays the path, as shown in
Figure
B.1. If the program does not find a valid JDK, it displays
an error.


The installation program will guide you
through the process of installing Tomcat. One option that the
program provides is the ability to install Tomcat as a
service. If you are using Windows XP, 2000 Pro, or Windows NT,
you should install Tomcat as a service. Doing this will cause
Tomcat to run in the background of your computer, even when no
user is logged into the computer.


Installing Tomcat as a service requires that
you select this as one of the options while the Tomcat
installation program is running. The window that allows you to
specify to run Tomcat as a service is shown in Figure
B.2.



Figure B.2.
Tomcat install options.


If you choose to run Tomcat as a service, you
must use the services manager to start Tomcat. From the
services control panel, you are able to see all of the
services that your computer is currently running or is aware
of. If you look at the line for the Tomcat Web server, you'll
notice that it is set to automatically start, yet it is not
running. This means that Tomcat will be started the next time
you restart your computer.


While you could restart your computer now to
start Tomcat, it is preferable to use the Services window to
start Tomcat. To do so, right-click the Tomcat line and choose
Start. Once you do, Tomcat will start. Figure
B.3 shows this process.



Figure B.3.
Starting Tomcat.


The Services window allows you to restart
Tomcat when needed. This is a handy feature because you will
frequently need to restart Tomcat. Any time that you deploy
new JAR files to Tomcat, for example, you'll have to restart
the Tomcat service. If Tomcat is not installed as a service,
the installation program places shortcuts for starting and
stopping Tomcat in the Programs menu.


Now that Tomcat is installed and running, we
can test it. To test Tomcat, open a browser on the computer
that Tomcat is running on. Once this browser starts, enter the
Web address class=docEmphHyperlink>http://localhost:8080/. This Web
address takes you to the Web server that is running on your
local computer on port 8080. If localhost does not
work, you can try entering the Web address class=docEmphHyperlink>http://127.0.0.1:8080/. If all
works well, your screen should resemble the one shown in Figure
B.4.



Figure B.4.
Accessing Tomcat.


By default, Tomcat will use port 8080 as the
Web address. If you would like to set up Tomcat so that it
runs on port 80, which is the usual Web port, you must modify
Tomcat's server.xml file. Once you modify Tomcat to run on
port 80, you will no longer need to specify a port address. If
Tomcat is running on port 80, it is enough to use the Web
address http://localhost alone to access the Web
server.











     Print  
     E-Mail
     
     Add
    Note    Add
    Bookmark
       




    Top

    [0672324504/app02lev1sec2]






     
     

    No comments: