I have a java class in which I have the method- getFiles() that prints a list of files in a directory. Here is the code
@Property
private String[] filesInDir;
public void getFiles(String path){
File aDirectory = new File("C://Users/A634682/report1/src/main/java/com/example/report1/reports2");
// get a listing of all files in the directory
filesInDir = aDirectory.list();
// sort the list of files (optional)
// Arrays.sort(filesInDir);
System.out.println("File list begins here >>>>>");
// have everything i need, just print it now
for ( int i=0; i<filesInDir.length; i++ )
{
System.out.println( "file: " + filesInDir[i] );
}
}
In the respective tml file, I want to print this string array containing file names in form of table on the webpage.
Any help in how I can proceed?