Is it possible to use libraries within the java project framework?

2

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>
    
asked by anonymous 10.08.2018 / 15:53

1 answer

2

Test with the code below and verify that it resolves.

<img src="<%= request.getContextPath()%>/newLib/minhaLogo.png" width=30>
    
10.08.2018 / 20:15