<%@ page language="java" import="java.util.*, oracle.jsp.webutil.fileaccess.*" errorPage="error.jsp" contentType="text/html;charset=UTF-8"%>
<html><body>
<% 
   // servletPath is the relative path from the jsp to the download 
   // servlet using the servlet's default mapping
   String s = request.getRequestURI();
   String servletPath = s.substring(0,s.indexOf("jsp/fileaccess")) + "servlet/download/";
   String userDir = "/";   
%>
<jsp:useBean id="dbean" 
   class="oracle.jsp.webutil.fileaccess.HttpDownloadBean"
   scope="session">
<jsp:setProperty name="dbean" property="source"  
   value='<%=userDir %>' />
<jsp:setProperty name="dbean" property="recurse" 
   value="false" />
</jsp:useBean>

<% 
   dbean.setBaseDir(application, request);
   dbean.listFiles(request);
 %>
     The following files were found:

<% Enumeration fileNames = dbean.getFileNames(); 
   while (fileNames.hasMoreElements()) { 
      String name = (String)fileNames.nextElement();
%>
    <br><a href="<%= servletPath + name %>" > <%= name %></a>
<% } %>

<br>Done!
</body></html>
