• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem showing .gif file in .html file from Tomcat

 
Nancy Lee
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi:
My system is Tomcat4.0 and Window 98.
I put a.gif and a.html files in the same directory under Tomcat4.0 but that a.gif picture simply does not show up in a.html page.
Where is the right place to put that a.gif file? Thanks in advance.
 
Adam Hardy
Ranch Hand
Posts: 567
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Often people put all their images together in one directory, but it's just a practice, not a necessity.
What are you using? An img tag or a button or an input or something? Show us an example of your HTML.
Or are you using Tomcat linked to Apache?
Regards
Adam
[ May 22, 2002: Message edited by: Adam Hardy ]
 
Nancy Lee
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Adam.
I put the statement <img src="a.gif" alt="a.gif">
inside <body> section. My purpose is to know the right place to put a.gif file, so I did not do any other thing in a.html file.
When I shot down the Tomcat and open a.html file directly, the a.gif picture just looks fine.
 
Adam Hardy
Ranch Hand
Posts: 567
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nancy,
I'm using taglibs to display my images (in struts) which takes care of stuff like this so I'm not sure how to do it without taglibs.
However, are both the html file and the gif in the website's root directory?
If so, try <img src="/a.gif">
You could also use the <base> tag in the html header. Check out
http://www.w3.org/TR/REC-html40/struct/links.html#idx-base_URI
That would be something like
<HEAD>
<TITLE>Our Products</TITLE>
<BASE href="http://www.aviary.com/products/intro.html">
</HEAD>
But that's a bit of PITA since you would have to change the tag every time you moved the file. In struts there is a <base> taglib that just works out what the URI is, so all you need is <html:base> and it does the rest itself and so moving it isn't a problem.
Perhaps someone else knows a simpler solution!
Adam
 
Nancy Lee
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Both the html file and gif file are in website's root directory.
I tried <img src="/a.gif"> and it did not work.
One thing I do not understand : I tried the statement <img src="tomcat.gif> and it works.
 
Adam Hardy
Ranch Hand
Posts: 567
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
which directory is tomcat.gif in? Not the same one surely?
 
Nancy Lee
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The tomcat.gif is in its original Root directory. It is there all the time. I just tried it.
 
Adam Hardy
Ranch Hand
Posts: 567
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can't get a handle on what your problem might be. In my tomcat 4.0.1 the examples app works fine, I just checked it out. You don't have to do anything special. Should be just like Apache.
Have you still got the problem? Maybe it's the gif - empty or something?
 
Nancy Lee
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I still have that problem. If I use Internet Explorer ,click the open file, go to that directory(tomcat 4.0.4 base directory/webapps/Root) and open a.html then both tomcat.gif and a.gif display on the screen. I simply could not see a.gif through http://localhost/a.gif
I am not very familiar with Tomcat system. Maybe I will figure the problem out some other time. Thanks a lot for your help, Adam.
Regards
Nancy
 
Adam Hardy
Ranch Hand
Posts: 567
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Must be a simple error - if img src=tomcat.gif works but img src=a.gif doesn't work, and both tomcat.gif and a.gif are in the same place, then it's got to be something wrong with a.gif
Try renaming it or something. When you get round to it. Good luck.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic