Skip to content

Instantly share code, notes, and snippets.

@codebrane
Created June 30, 2010 10:42
Show Gist options
  • Save codebrane/458509 to your computer and use it in GitHub Desktop.
Save codebrane/458509 to your computer and use it in GitHub Desktop.
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.io.File" %>
<%
String url = request.getRequestURL().toString();
String dirToList = request.getRealPath(request.getServletPath());
File jsp = new File(dirToList);
File jspDirectory = jsp.getParentFile();
File[] dirContents = jspDirectory.listFiles();
%>
<table>
<%
for (File file : dirContents) {
String href = url + file;
%>
<tr><td><a href="<%= file.getName() %>"><%= file.getName() %></a></td></tr>
<%
}
%>
</table>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment