How do you populate a dropdown list (inside a JSP page) dynamically with the folders contained in exactly the same directory because the JSP page, on Apache Tomcat?

use servletContext.getRealPath("/someuidir-in-your-webapp/somejspdir") to obtain the absolute path from the directory of this jsp after which make use of the and (blocking sites) . Here's the javadoc for getRealPath

Adding some code (Place the this inside your jsp). Observe that case a good example to enable you to get began regarding how to get it done. It should take some imporovement (when it comes to design)

  File jspDir = new File(application.getRealPath("/WebContent"));
  File[] list =  jspDir.listFiles(new FileFilter() {
        public boolean accept(File path) {
           return path.isDirectory();

  for(File f : list)   {
     out.write("<p>" + "</p>");  // replace this with whatever way you
                                 // want to populate