Published on Sep 8 2011 in Java Tomcat

Tomcat default home page contains links to examples, documaentation and management applications. See how to change it.

With Tomcat on dedicated JVM, you usually test it by loading http://yourdomain.com/ (If the default web server to application server catch-all mapping is set for your domain). The contents of that page are compiled into the index_jsp servlet. It is quite easy to override that page. In $CATALINA_HOME/conf/web.xml there is a section called and it may look like this:

<welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
</welcome-file-list>

The default servlet attempts to load the index.* files in the order listed. You may easily override the index.jsp file by creating an index.html file at $CATALINA_HOME/webapps/ROOT. It's somewhat common for that file to contain a new static home page or a redirect to a servlet's main page. A redirect would look like:

<html>
   <head>
   <meta http-equiv="refresh" content="0; URL=https://www.jvmhost.net/servlet/">
   </head>
   <body>
   </body>
</html>

This change takes effect immediately and does not require a restart of Tomcat.

Changing Tomcat's default web application

Implicit default web application is set to webapps/ROOT. To change it you can add

<Context path="" docBase="new_default_app" />

in Host entry for localhost in server.xml. Localhost Host is serving all requests until you define additional more specific Host(s).