<img> tag not working in JSP's on Tomcat 5.5 (Stuck on this!!)


Web tier: servlets, JSP, Web frameworks: <img> tag not working in JSP's on Tomcat 5.5 (Stuck on this!!)

  1. All,
     I've read quite a few articles on this issue and tried all the solutions given and none of them seem to be working.
     I'm using Netbeans 4.1 with Tomcat 5.5. My application is using the MVC pattern so I have a controller that is using the request dispatcher to forward a request to a JSP page.
     Basically I have an application at the context "/Company".
     I have all my images in a folder called "img" and all my JSP's in a folder called "jsp".
     I've tried using relative paths to the image directory and the images don't show up in the browser however if I look at the URL it seems right.
     I right-clicked to get properties and copied the URL:
     If I paste that into a browser I get a 404 error from Tomcat. However, if I take off the image name and do:
     I get a listing of the image files. If I click on the link for the image "image.jpg" it opens the file in the browser and I see the URL as:
     which is exactly the same as what I had manually typed in and what shows up in the properties window. Doesn't make any sense to me as to why it works one way and not the other. Possibly a permissions issue?
     Can anyone shed some light on why I can't get my image files to show up in my JSP pages? It seems to be finding my css file just fine though and I'm using a relative path for that.

    I've spent half a day on this issue and so far haven't found any solutions. Your help is greatly appreciated!!
  2. Check the html syntax[ Go to top ]

    When silly things does not work it is really disturbing.

    It happened with my once when i by mistake used attribute scr instead of src and scratched my heads for a while
  3. Well, I've got the same problem this morning. I think it was working ok last week, but as the browser caches the images I'm not sure. If I can work it out, I'll post my findings here. Martin
  4. Surely there should be a space or case issue in the path to the image.!
  5. ok, I've done three things, and now it's working again 1. install commons logging 2. ensure that tomcat logs are actually being produced 3. remove the mime settings I had added last week to web.xml I am using eclipse WTP, and I think the default web.xml is sufficient for my application
  6. Actually, it's still not behaving consistently. I'm still investigating.