Displayfile. Java
//*********************************
File parentdirectory = NULL; // Current Directory
Arraylist [] file = NULL; // stores all files in the current directory
Arraylist [] Directory = NULL; // stores all directories in the current directory
String [] temp = NULL; // temporary array stores all files in the current directory and the absolute path of the Directory plus the string with the complete name
File tempfile = NULL;
If (request. getparameter ("directory") = NULL)
{
Parentdirectory = new file ("C: // Temp"); // use the default directory for accessing objects using Servlet for the first time
}
Else
{
// The Directory submitted on the page for the second or later access is the default directory
Parentdirectory = new file (request. getparameter ("directory "));//
}
Temp = parentdirectory. List (); // extract the absolute path of all files and directories in the current directory and add the string with the complete name
For (INT I = 0; I <list. Length (); I ++ ){
// Check whether the directory is put into the directory set and the files are put into the file set
Tempfile = new file (temp)
If (tempfile. isdirectory ())
Directory. Add (tempfile );
Else
File. Add (tempfile );
}
//*********************************
Then, use the two sets on the JSP page to display the Directory and file directory. You can use the super connection to call the servlet above again.
"Displayfile? Directory = <% (File) file. Get (I). getname () %>"
If there is no environment, it is inevitable that there will be a problem ~~~~