How to Change Default Homepage in Tomcat

| Posted by watashii | Filed under Java, Software, Unix, Web

When browsing to a Tomcat’s webserver, at the root URL over the default port 8080, it usually shows the default jsp homepage as pictured above.

http://localhost:8080

So how can I update / modify, or remove this page?

You might think changing the jsp page at [$CATALINA_HOME/webapps/ROOT/index.jsp] is all you need to do. This is where i found out its not the case! The page contents are compiled within the ROOT web application servlet. To make Tomcat reference the jsp page instead, we need to remove this servlet from being compiled.

Locate the ROOT web application’s config file at [$CATALINA_HOME/webapps/ROOT/WEB-INF/web.xml], and simply comment out the following code fragment:

<!-- Comment this section so I can change the default index.jsp homepage
<servlet>
  <servlet-name>org.apache.jsp.index_jsp</servlet-name>
  <servlet-class>org.apache.jsp.index_jsp</servlet-class>
</servlet>

<servlet-mapping>
  <servlet-name>org.apache.jsp.index_jsp</servlet-name>
  <url-pattern>/index.jsp</url-pattern>
</servlet-mapping>
-->

This will disable the index_jsp servlet. Now when you restart the Tomcat web application server, it should compile and load the default [$CATALINA_HOME/webapps/ROOT/index.jsp] page instead.

Share:

  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Print
  • email

Related Posts:

  1. BusinessObjects Enterprise – Changing Tomcat Session Timeout

Tags: , ,

Comments are closed.