Image is not showing in JSP File

MartynasJankus :

I am having problems displaying an image in my .jsp file.

The image no_image.jpg is located inside the following directory of my Spring MVC application:

SpringProject\src\main\webapp\assets\images\no_image.jpg

I am trying to access it through my .jsp file like this:

<img src="${pageContext.request.contextPath}/assets/images/no_image.jpg"></a>

Project structure (using apache Netbeans IDE 11):

enter image description here

However this does not seem to display the image, does anyone have any ideas why?

MartynasJankus :

I have found the solution. For anyone else experiencing this issue, a possible solution is to put the following into your spring configuration .xml file: (Where you define your base package for the project, my one is named spring-config.xml)

<mvc:resources mapping="/assets/**" location="/assets/"/>

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=170778&siteId=1