I'm using a standard maven archetype of webapp, so I put my images folder under src/main/resources directory and in the war package it goes under WEB-INF/classes/ directory.
My project tree is in the following image
So the images dir is in the classpath and i load it via getResource
final String path ="/resources/images/disegno.svg";
URL imagePath = this.getClass().getClassLoader().getResource(path);
but i get
Could not complete request
java.lang.NullPointerException
when declaring path
Also in .jsp, I try to access the image in this way:
<img src="<%=request.getContextPath() %>/WEB-INF/classes/images/disegno.svg"/>
but no image is displayed, even if it links to
http://localhost:8080/svgTest/WEB-INF/classes/images/disegno.svg
I cannot understand how maven works in this situation, and cannot find a complete guide, because everywhere all looks so easy, so I don't know which error i'm doing...