How to call image path using JSP
When specifying an image path, we have two options: Provide an absolute path or a relative path. Assuming you have a webapp ROOT i.e. All your code is inside webapps / ROOT (ROOT is the default webapp in TOMCAT, i.e. the file inside webapps / ROOT / first.html can be accessed in the browser using http://example.com:8080/first .html .)
Or, if you have an example webapp; then webapps / example / first.html can be accessed using http://example.com:8080/example/first.html
So, if you have the following files: webapps / ROOT / jsp / first.jsp; and webapps / ROOT / images / logo1.jpg
Inside logo1.jsp, you can access the jpg like this:
<img src="/images/logo1.jpg" /> (absolute path; because it starts with a slash ; this slash is mapped to the starting directory)
<img src="../images/logo1.jpg" /> (relative path; because it DOES NOT starts with a slash ; you have to give path relative to location of your jsp )
source to share
Why is your jsp in the WEB-INF directory? Something strange? I usually use something like / web / jsp for my jsp files. WEB-INF should be dedicated to web.xml etc. At least I think so :)
Anyway, anything in the network root could be /foldername/file.ext
In your case, you should be able to use
<img src="/images/logo1.jpg" />
source to share