aspose file tools*
The moose likes Tomcat and the fly likes How to see my html file in my own directory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "How to see my html file in my own directory" Watch "How to see my html file in my own directory" New topic
Author

How to see my html file in my own directory

david hu
Ranch Hand

Joined: Jul 20, 2001
Posts: 143
Hi,
I just set up the tomcat, and make my own dir in the home direcotry of tomcat_home/webapps
I put one html file index.html in the tomcat_home/webapps/mydir
why I cannot see the file by using this:
http://localhost:8080/mydir/index.html
Does it have anything to do with web.xml?
Can anyone tell me how to see the my index.html?
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
That should work. What message are you getting when you try to display the page?


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Ash sav
Ranch Hand

Joined: Apr 14, 2001
Posts: 55
I also set up tomcat and try to see my index.html file from webapps directory, I am also getting same page as David. Can somebody tell me what is wrong?
Thanks in advance
Ash
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Originally posted by Ash sav:
I am also getting same page as David. Can somebody tell me what is wrong?
How do you know that you are getting the same page as David when David didn't tell us what page he is getting?
If one of you will tell me what you are getting, perhaps I might be able to help you!!!
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Did you look in your log files for messages? Did you get Tomcat to start up correctly?
If you want help you need to give more information that "it didn't work"!!!
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

There have been other posts in this forum that indicate you need a WEB-INF/web.xml file inside any directory under web-apps in order for Tomcat to 'load' it and be able to serve pages from it.
jason adam
Chicken Farmer ()
Ranch Hand

Joined: May 08, 2001
Posts: 1932
See http://www.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=56&t=000228 for the same discussion
[ February 27, 2002: Message edited by: jason adam ]
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Actually you don't need a web.xml file. You just need a WEB-INF directory. Even an empty one will allow Tomcat to load pages.
Ash sav
Ranch Hand

Joined: Apr 14, 2001
Posts: 55
Hi All,
Let me explain my problem. My directory structure
c:\Apache Tomcat 4.0
..webapps
|--example
|--manager
|--Root
|--tomcat-docs
|--webdev
|--index.html
My WEB-INF directory is inside of webdev directory.
I have created a directory called myjsp inside webapps where I stored first.jsp. When i type http://localhost:8080/myjsp/first.jsp I got following error
Apache Tomcat/4.0.1 - HTTP Status 404 - /welcome.jsp
type Status report
message /welcome.jsp
description The requested resource (/welcome.jsp) is not available.
I hope this description will help you to understand my problem.
Thanks,
ASh
Ash sav
Ranch Hand

Joined: Apr 14, 2001
Posts: 55
I am sorry I combined my previous error message with this one.
http://localhost:8080/myjsp/first.jsp
I got following erroe message.
Apache Tomcat/4.0.1 - HTTP Status 404 - /myjsp/first.jsp

type Status report
message /myjsp/first.jsp
description The requested resource (/myjsp/first.jsp) is not available.
Hoping to get some help.
Thanks,
Ash
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Every directory under webapps must have its own WEB-INF directory.
Ash sav
Ranch Hand

Joined: Apr 14, 2001
Posts: 55
Thanks all, everything works fine now.
Ash
david hu
Ranch Hand

Joined: Jul 20, 2001
Posts: 143
Thanks a lot for your reply!
Your suggestion are very good.
Shivaji Marathe
Ranch Hand

Joined: Jan 11, 2002
Posts: 203
I am having similar problems with running my jsp's under tomcat.
I am using tomcat 4.0.3 under windows NT.
I have a folder
tomcat_home/webapps/mytutorial
I have created a web-inf folder under this and copied a web.xml file from the
tomcat_home/webapps/root/web-inf folder .
I have shutdown and restarted tomcat server after doing this, I have rebooted the machine , to no avail. I get the 404 error message each time I try to access localhost/mytutorial/Hello.jsp.
The same file works fine under tomcat_home/webapps/root.
I copied and installed some examples from SUN's quick start guide (http://java.sun.com/products/jsp/html/jsptut.html) and I notice that the first time I access those samples, tomcat creates a folder under tomcat_home/webapps/<sun'sSample>/web-inf. But that folder does not contain any xml file.
What I am missing ?
[ March 07, 2002: Message edited by: Shivaji Marathe ]
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16250
    
  21

I am having similar problems with running my jsp's under tomcat.
I am using tomcat 4.0.3 under windows NT.
I have a folder tomcat_home/webapps/mytutorial
I have created a web-inf folder under this and copied a web.xml file from the
tomcat_home/webapps/root/web-inf folder .
I have shutdown and restarted tomcat server after doing this, I have rebooted the machine , to no avail. I get the 404 error message each time I try to access localhost/mytutorial/Hello.jsp.

... But did you tell Tomcat about it by defining a servlet context in tomcat/conf/server.xml?
Everyone repeat after me:
A WEB server is NOT a FILE server!
A WEB server is NOT a FILE server!
A WEB server is NOT a FILE server!
You CAN'T just plop in files and expect them to be served up like they were on a LAN. You have to configure the system properly!
LAN servers are dumb. All they do is copy. Web servers are smart. Smart enough not to copy anything that isn't explicitly marked for copying, and smart enough to know to run service applications if that's what they're marked for instead. What little security we DO see on the Internet is in large part due to this.
[ March 11, 2002: Message edited by: Tim Holloway ]

Customer surveys are for companies who didn't pay proper attention to begin with.
Shivaji Marathe
Ranch Hand

Joined: Jan 11, 2002
Posts: 203
Off course I have added a context entry in the tomcat_home/conf/servlet.xml file . This is what I have added
<Context path="/Jsptut" docBase="webapps/jsptut" debug="0" reloadable="true" />
Incidentally, when I installed and ran the examples from Sun's site, they did not add anything to the tomcat_home/conf/servlet.xml file. How do those examples work then?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to see my html file in my own directory