Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have Tomcat 7 configured to serve static contents from a directory:

<Host appBase="webapps" name="localhost">
    <Context docBase="/var/projectA/static" path="/projectA/" />

This is available at localhost:8080/projectA/. Is it possible to somehow enable directory listings for this context?

I know it's possible to do this with Apache in front of Tomcat, but that's not what I'm looking for.

share|improve this question

Convert your directory /var/projectA/static to a simple application:

  • create a directory WEB-INF/
  • in WEB-INF/ create the file web.xml with this content:
<?xml version="1.0" encoding="ISO-8859-1"?>


This way the directory listing is only active for your specified context and not global.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.