The following code will give you the contents of a particular directory (a 
list of files / folders), you could use this to configure/ select what you 
want to display, really up to yourself,
NOTE this isn't a servlet or jsp it's just a plain application, you'll need 
to tweak it to get what you want, 
Oisin


// DirList.java
// Displays directory listing.
/** DirList.java lists the contents of teh current directory
 *  by running it as java DirList after compiling it.
*/
import java.io.*;
import java.util.*;

public class DirList 
{
    public static final String foldername = "C:\\somedir";
  
    public static void main(String[] args) 
    {
      //first teh path for folder on the server is given
      File path = new File(foldername);
      
      //now we create an array of strings which will hold the file names
      String[] list;
    
      //get the file in the dir and copy the filenames to the array entries
      list = path.list();
    
      //output the filenames to system.out
      for(int i = 0; i < list.length; i++)
      { 
        //instead of just outputting them
        System.out.println(list[i]);
      }//end for
    }//end main
}//end class dirlist

On Friday 27 July 2001 12:01, Juan Fuentes wrote:
> I have an application with directory-browing="allow". When I request for
> a directory, orion displays a page with the directory list.
>
> How could I write a JSP/Servlet to customize this list ??
>
> TIA

-- 


Reply via email to