File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes How to stop directory viewing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "How to stop directory viewing" Watch "How to stop directory viewing" New topic
Author

How to stop directory viewing

Shaun Appleton
Greenhorn

Joined: Oct 31, 2002
Posts: 21
I can deploy my application using Tomcat/Jboss and all works fine. But when I go to the top level directory of my web app I can see all my JSPs/Gifs etc listed as a directory listing. Does anybody know how to turn this off?
Thanks in advance
Shaun
Ron Newman
Ranch Hand

Joined: Jun 06, 2002
Posts: 1056
Define a <welcome-file-list> in your web.xml file.
For instance, this one will redirect any request for the directory into a request for "index.jsp":
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>


Ron Newman - SCJP 1.2 (100%, 7 August 2002)
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12803
    
    5
Look in -home-/conf/web.xml at the default servlet parameters. Set the "listings" parameter to "false" to disable directory listings in directories that don't have a "welcome" file.
Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to stop directory viewing