1

I know this immediately sounds like the age old question but it's really not. In Eclipse under WebContent I have images, jsp, WEB-INF and META-INF. When I test using the Tomcat instance inside Eclipse the page tests fine. The image shows on the page and no problems. When I deploy the war file to Tomcat I check the application directory under webapps of Tomcat and it has css, images, jsp, META-INF and WEB-INF in the root. And the png file is definitely under the images directory. I still get a 404 when I attempt to test the page using a separate instance of Tomcat running at the command prompt.

The html is:

<img src="images/logo.png"> 

I have tried adding a "/" in front of images just in case. That didn't work either.

GISNovis
  • 117
  • 11

1 Answers1

1

You can try to use contextPath.

<img src="${pageContext.request.contextPath}/images/logo.png">

You could also set base tag:

<base href="${pageContext.request.contextPath}">

and then your tags with relative paths should work.

Krzysztof Atłasik
  • 21,985
  • 6
  • 54
  • 76
  • Thank you very much. There are many, many times the answer is there in front of you but nearly impossible to find. You just have to guess the right search terms. That can be total luck. – GISNovis Aug 03 '16 at 18:19