1
I need to display an image inside the tag img
.
It is a web project, running on Tomcat and Ubuntu Mate. I saved in bank as String the path to where the image is:
"/opt/imagens/img.png"
To display, I put it this way
<img src="<%=urlImg.getUrl()%>" >
urlImg.getUrl()
returns "/opt/imagens/img.png"
The image does not appear, someone, please, would be able to explain to me what is wrong and what should be done to correct?
If it was saved in the bank as
/opt/imagens/img.png
it makes perfect sense to show off/opt/imagens/img.png
, you have to consider what is the path/route to the HTTP server, you must have created the "mapping" for the static files, no?– Guilherme Nascimento
Guilherme, I didn’t map, what would that be? This folder is outside the project, it is an operating system folder.
– Maycon Stanguine
do you know how to point the images folder to a route on Tomcat Hosts? I will try to post an answer with example, maybe it will help
– Guilherme Nascimento