Forums Register Login

How get all image names of files in an image folder in JSF or JSP

+Pie Number of slices to send: Send
How get all image names of files in an image folder in JSF or JSP? after will use SERVER SIDE to eject html to view all images of the folder in a web page...
+Pie Number of slices to send: Send
J2EE is not a file server architecture. The only way to get the names of image resources is if the web application was designed with an application function to look into whatever places your images are being held and enumerate what it finds there.

This task is further complicated because the official format for a webapp is a WAR file, and unless the server is working with an "exploded" (unzipped) copy of that WAR, there are no actual files, just indexed members of the WAR (ZIP entries). Or, in other words, there's nothing to run the java.io.File list method against.
+Pie Number of slices to send: Send
btw this needed to add images from a security IP camera and view in a web page all images currently....
+Pie Number of slices to send: Send
You can use the java.io.File class and its "list" method to scan a folder and return a list of files that match a filter that you define.

IMPORTANT

Do NOT store image files (or any other uploaded file) inside a WAR. It won't always work and when it does, sooner or later it will bite you. Use an external folder that's not part of either the webapp or the webapp server.
+Pie Number of slices to send: Send
What is easier to get done with JSP or with JSF? I did JSP course in the past but recently read 3 chapters in JSF...
ARE THEY THE SAME DIFFICULTY ABOUT?
+Pie Number of slices to send: Send
No need to shout.

Getting the filename list is POJO and the same code works for JSF, JSP, even Struts.

Presenting the images on a web page is more platform specific and which platform can make that job easiest is debatable. It's about the same amount of work either way.
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1843 times.
Similar Threads
here's the task i'm trying to accomplish.. how to read directories and files withJSP
Getting names of files in a folder
cheking files and give to alert to jsp
Print Image using Jstl
How can I tell JSF that my jsp files are in a different folder than webroot?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 19, 2024 02:00:13.