dom,
I’m moving this to Random Thoughts because this isn’t related to ME but is instead a problem that any web application developer must overcome when dealing with web context paths.
Now as far as getting around this problem, you can try and use the <html:base /> tag from Struts to set a base for each page, or what I prefer is the html:rewrite tag and/or the page argument which will do a application-relative lookup for a resource.
If you aren’t using Struts and just want a vanilla way to do this, from your JSP page you can get the servletContext and determine the path of this base servlet that was called, and then prepend that to your image path:
<img src=”<%= basePath %>/images/header.gif”>
or something like that.