Preventing directory listing using Tomcat

Open the web.xml of your tomcat installation. Please do not edit the web.xml in servlets!

Toggle the boolean as follows:

<init-param>
  <param-name>listings</param-name>
  <param-value>false</param-value>
</init-param>