我在调用 java 文件时遇到了一些问题,我创建了一个 java 文件
@ManagedBean(name="pdfSearch")
public class pdfSearch {
public String NewDestination;
public void main(String[] args) throws IOException {
File dir = new File(NewDestination);
String[] extensions = new String[]{"pdf"};// Add more file formats here to disply, could use this later on to display to the user all the files they have uploaded
System.out.println("Getting all .pdf files");
List<File> files = (List<File>) FileUtils.listFiles(dir, extensions, true);
for (File file : files) {
System.out.println(file.getCanonicalPath());
}
}
}
但我不能调用它从命令按钮运行
<p:commandButton action="#{pdfSearch.main}" value="Search" ajax="False"/>