I am developing a simple Java application using the struts 2 framework. The purpose of the application is to show a specific directory structure under my computer using the JSP page.
My question is which data structure to use to maintain the directory structure so that the JSP page can access this directory structure object from the action class.
ps: I want to use the following java code to navigate the directory.
Help Plz
import java.io.File; public class DisplayDirectoryAndFile{ public static void main (String args[]) { displayIt(new File("C:\\Downloads")); } public static void displayIt(File node){ System.out.println(node.getAbsoluteFile()); if(node.isDirectory()){ String[] subNote = node.list(); for(String filename : subNote){ displayIt(new File(node, filename)); } } } }
source share