This is a container tag used to specify a Java servlet and it's parameters.

Servlets cannot be called directly unless the InvokerServlet is enabled, so one or more servlet tags and servlet-mappings must exist for each servlet, to tell Tomcat when to call the servlet.

There are two required elements:

  • <servlet-name> - the servlet name, this is used to match the <servlet-name> element in one or more <servlet-mapping> tags
  • <servlet-class> - the canonical class name of the servlet (eg: SimpleServlet or com.metawerx.servlets.SimpleServlet if it's in a package)

Full Servlet Definition Example

    <!-- Simple Servlet, provide a name, class, description and map to URL /servlet/SimpleServlet -->
            <description>This is a simple Hello World servlet</description>

See Also

  • web.xml reference guide for a full example of using the servlet tag and it's child elements
metawerx specific

referring pages