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...
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.
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.
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?
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.
Post by:autobot
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