I'm including a separate JSP page (header.jsp
) into my current home.jsp
page as goes:
<jsp:include page='/WEB-INF/Header/header.jsp'/>
In that header.jsp
page, I have an image as follows:
<img id="myImage" src="<c:url value='../Images/myImage.jpg'/>" />
But my image is not displaying on my home.jsp
even though all the other elements (i.e. paragraphs, anchor links, etc.) found inside header.jsp
is displaying normally on the home.jsp
page as it should.
My folder structure goes:
MyProject
WebContent
WEB-INF
Header
header.jsp
Images
myImage.jpg
Views
Home
home.jsp
How do I specify the path file to my image (<img id="myImage" src="<c:url value='?/myImage.jpg'/>" />
) from within my header.jsp
file?
I seem to have it working:
img src="${pageContext.request.contextPath}/Images/myImage.jpg"
Please let me know if this is an ideal way to go about this in JSP.