I'm working on an application and where I need to refer my application images and other things like js etc. now in my JSP files when I'm trying to load images using this path
<img src="static/media/images/logo.gif" alt="welcome" />
I saw the following error in the browser: unable to load the image
I even tried to refer the absolute path
<img src="/static/media/images/logo.gif" alt="welcome" />
but still no luck at all. Finally when I appended my project name it started working. E.g if my web-application name is abc
I used following thing
<img src="/abc/static/media/images/logo.gif" alt="welcome to donateblood.com" />
but that I'm sure not the right way to refer the images as this means change in web-application name will lead me to change each and every URL of image which is not feasible at all. The images which has been mentioned inside the css file are working perfectly fine. can anyone guide me the proper way to refer the images.
Additional information: I'm using eclipse as my IDE and Tomcat as the container along with it is a Java EE standard web-application