Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Remove suggestion of replacing the default servlet. It is irrelevant to the issue. Correct links.

...

Just by doing this, you have already made you webapp into the Tomcat default webapp.

One step is left : you also need to have, within your application, a default servlet. If you don't want to use the standard one supplied by Tomcat that does nothing but deliver static content, you'll need to supply one of your own. This you do by means of an appropriate url-mapping in the WEB-INF/web.xml configuration file of your application. Make sure you have something like this in that file:

No Format

   <servlet>
        <servlet-name>My First Servlet</servlet-name>
        <servlet-class>my.Servlet.Number1</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>My First Servlet</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>

The above will override the mapping for Tomcat's DefaultServlet in the global conf/web.xml file.

Restart Tomcat and you're done.
Call up "http://myhost.company.com/" and enjoy.

...

For more information about this topic in general, consult this page : The Context Container "Configuration Reference / Context"

Addendum 2 : If for some reason you want another method..

If, for some reason, you do not want to deploy your application under the CATALINA_BASE/webapps/ROOT subdirectory, or you do not want to name your war-file "ROOT.war", then read on. But you should first read this : The Context Container "Configuration Reference / Context" and make sure you understand the implications.

...