Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

question about JSP - Tomcat

 
Monica Moncho
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

I'm starting with JSP and I don't know why when I put my HTML and JSP files in the webapps folder of the tomcat directory I cannot retrieve them. Tomcat is not finding them. If I put the same directory (I have the files in my own directory which I put in webapps) under ROOT (tomcat\webapps\ROOT\mydirectory), it works. I have folders from examples directly under webapps and they work. Do you know why?

thank you very much again. Maybe one day I can also answer questions :-)
 
Ramaswamy Srinivasan
Ranch Hand
Posts: 295
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Monica,

Welcome to Javaranch....Wish you a nice time here.

What does the call to localhost return?

Say, when you call http://localhost:8080, what is your browser
showing up?

Cheers,
Swamy.
 
Roshini Sridharan
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Monica,

U can place the JSP files in webapps\examples\jsp folder and
and try with URL http://localhost:8080/examples/jsp/JSPFileName


To create ur own Webapp folder

1. Create the sub folder as mentioned below
webapps/foldername
webapps/foldername/jsp
webapps/foldername/web-inf
webapps/foldername/classes

2. Make a entry in tomcat4.0\conf\server.xml as follows in tomcat root context.

<Context path="/folderpath" docBase="foldername" debug="0"/>

3. set classpath to servlet.jar in lib folder

4. In case of Servlet, compile the servlet
javac -d ./web-inf/classes ServletFile.java

places the class file in /web-inf/classes subfolder

5. start the server
bin/startup.bat

All the Best.

Regards
Roshini.S
 
Monica Moncho
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The error I was getting yesterday was the one that says that it cannot find the file.

Now I changed the server.xml file to have the context path to my folder and it works!

Thank you very much to both of you. So much to know....I will probably have more questions. I hope nobody has ever been kicked out for having too many :-)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic