<%@ page import="java.io.File" %> this.getServletContext().getRealPath ( request.getServletPath() ) = <%= this.getServletContext().getRealPath ( request.getServletPath() ) %>

<% File directoryFile = new File ( this.getServletContext().getRealPath ( request.getServletPath() ) ); %> File exists: <%= directoryFile.exists() %>

File is directory: <%= directoryFile.isDirectory() %>

<% // if file not directory get parent if ( ! directoryFile.isDirectory() ) { directoryFile = new File ( directoryFile.getParent() ); %> Getting parent of file

<% } // end if file not directory %> File is directory: <%= directoryFile.isDirectory() %>

Directory List : <% String [] directoryListArray = directoryFile.list(); %>