Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

not making the JSP pages visible using tomcat server  RSS feed

 
Mahesh Pinnamaneni
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello buddies,
i am having JSP files of my application in a folder hierarchy like this.
webapps->project/JSP (my JSP files)
/WEB-INF

when ever i use this link like "http://abc:8080/project/JSP" Apache Tomcat server will display all the files in that directory.i don't want this to happen.infact when i access this URL i have to redirect to my applications index.jsp page.how can i achieve this.
thanks & regrds,
Mahesh
 
Rajan Chinna
Ranch Hand
Posts: 320
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to set this in your server.xml file.

Ex:
<Context path="" docBase="project/JSP" debug="0" reloadable="true">
 
Mahesh Pinnamaneni
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello rajan,
when i paste the code in my server.xml file and start the server, it is n't starting ans also no message is diaplayed.it gives the splash screen and disappears.
plz solve my problem. i am using tomcat 5.0 webserver
regards,
mahesh
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
add the following to the web.xml for your web-application to make JSPs inaccessible to the outside world.

Mind this also means that any request to them will be denied with a security error "HTTP Status 500 - Configuration error: Cannot perform access control without an authenticated principal" as Tomcat will tell you.

You will thus need (no bad thing) a servlet to forward requests to the JSPs.
 
Rajan Chinna
Ranch Hand
Posts: 320
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make sure u have set JAVA_HOME and CATALINA_HOME environment variables.

Try to capture the error while u restart tomcat, u can redirect the console output to a text file and check the error message.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In order to prevent Tomcat displaying a directory listing under any circumstances, make sure the default web.xml in the conf directory has the listings parameter set false as in this:


That creates the default setting. You can turn it back on for specific web applications web.xml.
Bill
 
Mahesh Pinnamaneni
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok guys, now i am not getting displayed the Directory Listing of my project. but i want to display the login.jsp page when ever the user typed the URL like http://abc:8080/project
how can we do this.
thanks & regds,
Mahesh
 
Rajan Chinna
Ranch Hand
Posts: 320
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
change your login.jsp as index.jsp OR call your login.jsp from your index.jsp.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OR add a welcome-file-list to your web.xml which specifies login.jsp as the index file.

When combined with what I listed earlier you'd need to have it in another directory or forward to it from a servlet of course.
 
Ramaswamy Srinivasan
Ranch Hand
Posts: 295
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mahesh,

It can be simply done in the way Jeroen had suggested.

In the web.xml file of your own application, in your case project\web-inf folder,add the following lines



This should be helpful.

Cheers,
Swamy
 
Mahesh Pinnamaneni
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

It works.
thanks for ur contribution.
regards,
Mahesh
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!