tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Vu <>
Subject Re: Running Servlets on Tomcat4.0
Date Mon, 12 Nov 2001 16:10:04 GMT
Here's a snippet from the sample web.xml file from the
Tomcat docs.  At the bare minimum, you just need to
define the servlet name, the class associated with the
servlet, then map the servlet to a URL pattern:

<!-- Servlet definitions for the servlets that make up
         your web application, including
         parameters.  With Tomcat, you can also send
         to servlets not listed here with a request
like this:


         but this usage is not guaranteed to be
portable.  It also
         makes relative references to images and other
         required by your servlet more complicated, so
         all of your servlets (and defining a mapping
to them with
         a <servlet-mapping> element) is recommended.

         Servlet initialization parameters can be
retrieved in a
         servlet or JSP page by calling:

             String value =

         where "name" matches the <param-name> element
         one of these initialization parameters.

         You can define any number of servlets,
including zero.

        This servlet plays the "controller" role in
the MVC architecture
        used in this application.  It is generally
mapped to the ".do"
        filename extension with a <servlet-mapping>
element, and all form
        submits in the app will be submitted to a
request URI like
        "", which will therefore be
mapped to this servlet.

        The initialization parameter namess for this
servlet are the
        "servlet path" that will be received by this
servlet (after the
        filename extension is removed).  The
corresponding value is the
        name of the action class that will be used to
process this request.
      <!-- Load this servlet at server startup time

        This servlet produces GIF images that are
dynamically generated
        graphs, based on the input parameters included
on the request.
        It is generally mapped to a specific request
URI like "/graph".

    <!-- Define mappings that are used by the servlet
container to
         translate a particular request URI
(context-relative) to a
         particular servlet.  The examples below
correspond to the
         servlet descriptions above.  Thus, a request
URI like:


         will be mapped to the "graph" servlet, while
a request like:


         will be mapped to the "controller" servlet.

         You may define any number of servlet
mappings, including zero.
         It is also legal to define more than one
mapping for the same
         servlet, if you wish to.



--- LIM TIENAIK <> wrote:
> Can anyone give me some guidelines  on how to run
> the servlets on tomcat. I 
> just can't figure out how the web.xml works.
> Get your FREE download of MSN Explorer at
> --
> To unsubscribe:  
> <>
> For additional commands:
> <>
> Troubles with the list:
> <>

Do You Yahoo!?
Find a job, post your resume.

To unsubscribe:   <>
For additional commands: <>
Troubles with the list: <>

View raw message