Hi, I have developed an application in jsp using Apache Tomcat 4.0. Application default page is a jsp page and not a index.html. but when user access the site, it displays list of files present in that folder. In simple words, how to disable directory and files listing for the end user using Apache- Tomcat 4.0 Thanks
Afroz
gautam shah
Ranch Hand
Joined: Oct 29, 2000
Posts: 72
posted
0
Originally posted by Afroz Khan: Hi, I have developed an application in jsp using Apache Tomcat 4.0. Application default page is a jsp page and not a index.html. but when user access the site, it displays list of files present in that folder. In simple words, how to disable directory and files listing for the end user using Apache- Tomcat 4.0 Thanks
write an entry in web.xml for welcome page pointing to ur first JSP
Afroz Khan
Ranch Hand
Joined: Aug 07, 2000
Posts: 105
posted
0
Thanks Gautam Can u give an example for this. As to what is the tag to be used in web.xml Thanks Afroz
gautam shah
Ranch Hand
Joined: Oct 29, 2000
Posts: 72
posted
0
Originally posted by Afroz Khan: Thanks Gautam Can u give an example for this. As to what is the tag to be used in web.xml Thanks Afroz
<welcome-file-list>
<welcome-file>/entry_page.jsp</welcome-file> </welcome-file-list> this path is relative to ur application context
Afroz Khan
Ranch Hand
Joined: Aug 07, 2000
Posts: 105
posted
0
Hi gautam, i guess i put the question in a different way. i mean we have a access folder. my application is http://127.0.0.1/gdc/Login.jsp and when the user enters the url till like http://127.0.0.1/gdc it displays the liting of the files and folders. Thanks Afroz
gautam shah
Ranch Hand
Joined: Oct 29, 2000
Posts: 72
posted
0
Originally posted by Afroz Khan: Hi gautam, i guess i put the question in a different way. i mean we have a access folder. my application is http://127.0.0.1/gdc/Login.jsp and when the user enters the url till like http://127.0.0.1/gdc it displays the liting of the files and folders. Thanks Afroz
just put ur login.jsp in gdc folder. write followinf entry in web.xml <welcome-file-list> <welcome-file>login.jsp</welcome-file> </welcome-file-list> then type URL http://127.0.0.1/gdc and see what happened. I've had tested this thing already on tomcat. and if after that it doesn't work then u just contact me on gautam_shah_29@yahoo.com . i am online there . i will show u on my static machiene.
Afroz Khan
Ranch Hand
Joined: Aug 07, 2000
Posts: 105
posted
0
Thanks Gautam I got my problem solved and its working fine now. Thanks again Afroz
sony gam
Greenhorn
Joined: Jun 20, 2001
Posts: 28
posted
0
Hi, If suppose i have several folders in my web app, then how can i acheive this. Because obviously there can be only one welcome file for a web aplication. Thank you, Sony gam
sampy jagan
Ranch Hand
Joined: Sep 17, 2002
Posts: 34
posted
0
In Web.xml, set the listing attribute to false to disable the directory browsing. <init-param> <param-name>listings</param-name> <param-value>false</param-value> </init-param> Hope this helps... Regards jagan
sampy jagan
Ranch Hand
Joined: Sep 17, 2002
Posts: 34
posted
0
Sorry, Ignore my prev reply. For Tomcat change the listings attribute of the StaticInterceptor to false in Server.xml Ex: <StaticInterceptor listings="false" /> Regards jagan
Praful Thakare
Ranch Hand
Joined: Feb 10, 2001
Posts: 513
posted
0
Hi Sony For every context(Folder) in tomcat there is web.xml file in WEB-INF folder,so for every contecxt u need to make change in that file hope this helps ..Praful
All desirable things in life are either illegal, banned, expensive or married to someone else !!!
subject: URGENT: Disabling directory listing in Tomcat 4.0