My question is as follows, can I by way of relative path link my .JSP to a library within the project directory? Or just in the server directory: Webapps, etc?
Currently, when I want to show an image on my system, I do the following:
<img src="http://localhost:8080/minhaLogo.png"width=30>
What'sinthedirectory:
C:\ProgramFiles(x86)\ApacheSoftwareFoundation\Tomcat8.5\webapps\ROOT\minhaLogo.png
Everythingunderneathwebapps/rootiseasytoaccess.
However,Iwouldliketousethelogowithinarelativepathofmyprojectfolderstructure:
Itriedthisinseveralways,butIwasunsuccessful,eventhoughtheconsolesaysIhada%cosoftheimagedoesnotload.IsitpossibletodowhatI'mtryingtodo?
I'vetriedsomethinglikethat,withseveraldirectoryvariations,butnosuccess:
<imgsrc="<%= request.getContextPath() + "/newLib/minhaLogo.png" %>" width=30>
Thank you very much.
EDIT:
As a test page, it is simply a page with the image in the body:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>teste link relativo</title>
</head>
<body>
<a class="bt"><img src="<%= request.getContextPath()%>/newLib/minhaLogo.png" width=30></a>
</body>
</html>