Find.java import java.io.File; import java.util.ArrayList; import java.util.List; public class Find { public File folder = new File(""); static String temp = ""; private String text; public void setText(String text) { this.text = text; } public String getText() { return text; } public List<String> getList() { return getFiles(new File(text)); } private List<String> getFiles(File f) { List<String> result = new ArrayList<String>(); if (f.isDirectory()) { File[] list = f.listFiles(); if (list == null) { return result; } for (File d : f.listFiles()) { if (d.isDirectory()) { result.addAll(getFiles(d)); } else { result.add(d.getName()); System.out.println(d.getPath()); } } } return result; } secondpage.jsp
!DOCTYPE HTML> <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@page import="ru.sbrf.asfs.stub.stubsUtils.Find"%> <%@page import="java.util.List"%> <%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <% Find find = new Find(); String name = request.getParameter("text"); System.out.print(name); find.setText(name); List<String> list = find.getList(); %> <html> <head> <title>secondpage</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> </head> <body> <table border="1"> <th value=> <c:forEach var="l" items='<%= list %>'> <c:out value="${l}"/> <br> </c:forEach> </th> <th Путь> </th> </table> </body>