• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

How to see my html file in my own directory

 
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That should work. What message are you getting when you try to display the page?
 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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"!!!
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Chicken Farmer ()
Posts: 1932
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Every directory under webapps must have its own WEB-INF directory.
 
Ash sav
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks all, everything works fine now.
Ash
 
david hu
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot for your reply!
Your suggestion are very good.
 
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Saloon Keeper
Posts: 28601
211
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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 ]
 
Shivaji Marathe
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic