I have a Web system in which I have a folder with files and what I'm trying to do is bring the names of the files into that folder.
Command to call a JSP from JS
:
getUrlJsonObject({
href:pathcamp+'getNamesDocs.jsp',
method:"GET",
},
function(data){}
this is the JSP
<%
final File folder = new File("/docs");
for (final File fileEntry : folder.listFiles()) {
if (fileEntry.isDirectory()) {
listFilesForFolder(fileEntry);
} else {
System.out.println(fileEntry.getName());
}
}
listFilesForFolder(folder);
%>
But I get the following error:
An error occurred at line: 2 in the jsp file: getNamesDocs.jsp
File cannot be resolved to a type
1: <%
2: final File folder = new File("/docs");
3: for (final File fileEntry : folder.listFiles()) {
4: if (fileEntry.isDirectory()) {
5:
listFilesForFolder(fileEntry);
Thanks in advance.