how to read/scan a folder
1 posts in topic
Flat View  Flat View

Posted By:   cforcloud_karul
Posted On:   Wednesday, October 17, 2007 05:36 PM


i have a folder in which there are number of XML files named like , .. etc.

these XML files need not be named always in series.

can you find me a JSP script that can read the number of files and give me the list of there names

great thanks.

Re: how to read/scan a folder

Posted By:   Robert_Lybarger  
Posted On:   Thursday, October 18, 2007 08:53 AM

<% /* open a scriptlet and do it in java */ %>

File dir = new File("/some/where");
FilenameFilter filter = new FilenameFilter() {
public boolean accept(File file, String name) {
return name.endsWith(".xml");
File[] files = dir.listFiles(filter);
List names = new ArrayList();
for (File file : files) {

/* set the 'names' list into the page context if you
want to access it conveniently in EL code */

About | Sitemap | Contact