Issue
I am new to spring MVC and I have a application which store images in the root directory of the application.
The directory is something this like this : C:\Users\Golla\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\medicalus\images\1423310234176.png
My Project's name is medicalus and the images folder is used to save images. Now I want to retrieve it and display it in the jsp page. I have tried giving up the complete path of images and tried adding in < mvc:resources> tag of servlet dispatcher but none of these worked.
How can I display images which are located in the root directory of the server? Any suggestion would be appreciated.
Solution
Try this:
In the Spring's configuration file:
<mvc:resources mapping="/images/**" location="/images/" />
In you JSP:
<img src="${pageContext.request.contextPath}/images/1423310234176.png" />
Answered By - Paul Vargas
Answer Checked By - Marie Seifert (JavaFixing Admin)