Blog Archive

Display Project/Directory listings in Tomcat Home Page

How to display a list of all applications deployed inside the Tomcat Webapps folder

By default the ROOT application index file in Tomcat has the Tomcat Home Page. But if you want to display a List of all the applications hosted in the webapps folder for that Tomcat Instance then create a project named ROOT in eclipse and change the index.jsp to the following code. After that just Export a WAR file named ROOT.war into the webapps directory.

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
<%@ page import="*" %>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Your application Title</title>

<div id="allContent">
    String root = getServletContext()
    String ignored = "ROOT"; file; dir = new;
    String[] list = dir.list();

    for (int i = 0; i < list.length; i++) {
        file = new + list[i]);
        if (file.isDirectory() &&
            ) {
             <a href="/<%=list[i]%>/" target="_top"><%=list[i]%></a>