how to load image from java project's resource/images folder?

SachinKakkar

I am developing a shopping cart in Sprng MVC from where seller can upload products image with its description. I am able to upload images to webapp/resources/images folder. now I have to load all these images to dashboard page (home page) when any user open my site. I am not able to load these images from this location.

In my jsp I am writing final code like this:

<img src="resources/images/product1.jpg"/>

how can I add this folder to classpath so it'll be available. I am using Spring MVC and MAVEN.

Please let me know how to achieve this.

SachinKakkar

I am able to fix this problem: Added the following resources declaration to Spring configuration

<resources mapping="/resources/**" location="/resources/" />

and in jsp

<img src="<c:url value="/resources/images/product1.jpg" />" alt="" />

Thanks guys for your all help, your direction really helped me to get the answer for this problem.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Load image from a file inside a project folder

How to run .sh file from res folder in java project on linux?

how to load a image from web in java

How to load a folder from a .jar?

Is there a way to load (with new File()) image that had been imported into the Project Folder?

How to load an external properties file from a maven java project

Xamarin: How to load image from iOS library project

How to load GIF image from drawable folder into ImageView using glide?

Rails: How to display image from rails local project folder?

How to load all images from folder? (Processing, Java)

Read/Load image file from the StreamingAssets folder

How to load image outside of Frontend folder

Java - How to Load a Custom Font From a Resources Folder

Converting image from project folder

WPF load image from folder

How to retrieve image from project folder

How do you add image files from a folder with Java?

How to download a pdf file from project folder in java

Load image from project folder in a html format to show in webcontrol

How to load image from resource folder and set it to source image of UI Image in unity5

java web appliaction save image on project folder

How to load file from folder within a gradle external library (JAVA)

OpenCV - Load newest image from folder

How to identify project type from project folder

Load image from project file into ImageSource with Nativescript

Xamarin Forms Load image from folder inside project

Load images and save them in the project's folder

How do I load an image from my project folder inside a JavaScript file?

How to send a get request in GraphQL, to get an image from the project's folder?