views:

385

answers:

1

how to hide folder structure of website from users. i have developed a website on jave platform (jsp). website is deployed on jboss. suppose my website 's home page url is

dummy.com/dummyFolder/dummy1.jsp

user can watch all of jsp pages in website by going on url

dummy.com/dummyFolder/

what should i do to prevent user to view my website directory structure?

+7  A: 

In the default web.xml of the application server you need to disable the directory listing feature. In case of JBoss AS (specifically: Tomcat) you need to set the DefaultServlet's initialization parameter listings to false:

<init-param>
    <param-name>listings</param-name>
    <param-value>false</param-value>
</init-param>
BalusC
+1 something new for me to learn today :)
skaffman
ditto on learning something new
ChadNC
its not working.
Maddy.Shik
Then you did something wrong. Ensure that you're working on the right server. Review the steps you did. Don't forget to reboot the server after the change.
BalusC
is it possible to hide static resources like *.html,*.jsp
Maddy.Shik
You mean hiding from *direct* access? That's an entirely different problem/story. Placing them in `/WEB-INF` and using a page controller servlet should do.
BalusC