This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes JSP and the fly likes question about JSP - Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "question about JSP - Tomcat" Watch "question about JSP - Tomcat" New topic
Author

question about JSP - Tomcat

Monica Moncho
Ranch Hand

Joined: Dec 01, 2004
Posts: 31
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

Joined: Aug 31, 2004
Posts: 295
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

Joined: Jan 16, 2001
Posts: 143
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

Joined: Dec 01, 2004
Posts: 31
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 :-)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: question about JSP - Tomcat
 
Similar Threads
Make Tomcat go
Where to place - under webapps or ROOT ?
serve static HTML from app context rather than ROOT
can't access tomcat-docs webapp
Customize 404 errors in Apache Tomcat