The problem with files is if i have bulk of users i should download images for every user in a certain folder and pass them to jsp.which is unfriendly.Is there any way.
Asked
Active
Viewed 142 times
0
-
1Didn't understand a thing here, sorry. Try to reformulate what you want to do more precisely. – Tunaki Sep 07 '15 at 13:45
-
1I believe, he is storing images in a database (as blobs), and then tries to serve them to users. However, application server is serving static files from the directory but not from the database. Therefore, he is preloading the required images on each request from the database to some directory. – bezmax Sep 07 '15 at 13:54
1 Answers
0
Well, you can create a separate controller which serves images directly from the database, and then use the path of this controller in all of your JSPs. This way you will not need to "preload" the images into some local directory.
In case this happens to be slow, configure some kind of caching layer in front of the application in nginx or apache httpd.

bezmax
- 25,562
- 10
- 53
- 84
-
Thanks for your response Max.Is it possible to get the 5 images out of many and send to client.And if client requests more 5 then other request to database and get those other 5 in jsp. – Srinath Murugula Sep 07 '15 at 13:57
-
Just create some kind of ImageController, with method "getImage" which takes an argument "imageId", loads that image from database and sends it back to the client. Then, if the client needs 5 images, he will call this controller 5 times. When he needs 5 more - he will call it 5 more times. Here are some links to help you out: http://stackoverflow.com/questions/9164103/show-image-from-db-using-spring-mvc http://stackoverflow.com/questions/26400994/how-to-display-image-from-mysql-database-using-spring-mvc – bezmax Sep 07 '15 at 14:02