The irony is I created the header.gif using paint, the other two gifs were copied from tomcat examples. The problem here is I can't load any image I create except those copied from tomcat examples. I also created images using adobe photoshop, still no way around it.
However, when run the same code in html, exactly the same situation.
Is there anything I am doing wrongly or is there anything about how tomcat reads images that is not specify in the Headfirst servletandjsp text book I am using. However, the servlet version I'm using is version 5.0.
Images are images; they'll either display or they won't. And whether the img tag is in a plain html page or one dynamically generated, via JSP or otherwise, is moot.
Firstly, are the URLs correct? You are using a relative URL which can be iffy.
Secondly, do the images display in the browser when open them directly (File > Open..)? If not, something is wrong with your image files. If so, then the URLs are the most likely culprit.
Joined: Apr 25, 2004
First I must thank you very much for your reply. All the images and, html and jsp are in the same folder. Without using the Tomcat container, all the images worked as the should. But as soon as I run tomcat and then comes the problem. I also noticed when i changed the Image type for the okay images to jpg, they also failed to show up. This problem shows up when I am using tomcat to test the site I am building.
As far as I know, MS-Paint can only create bitmaps ".bmp". It is possible that you gave a ".gif" extension to a bitmap file?
I'm thinking that the browser is figuring out the file type when you hit it directly from the file system but getting confused when fetched via Tomcat because Tomcat is seeing the "gif" extension and sending incorrect mime-type instructions.
Paint can create GIFs as well as BMPs (and JPEG, TIFF, PNG), but the default is indeed BMP. As suggested, make sure that your image is really a proper GIF, and not some other format with a ".gif" extension.
Ping & DNS - updated with new look and Ping home screen widget