当我实现 Primefaces UserGuide 中的 Primefaces FileDownload 类时,我的 IDE 显示设置方法返回类型为 void 或更改为构造函数。
公共文件下载控制器()
public class FileBean {
private StreamedContent file;
public FileDownloadController() {
InputStream stream = this.getClass().getResourceAsStream("yourfile.pdf");
file = new DefaultStreamedContent(stream, "application/pdf",
"downloaded_file.pdf");
}
public StreamedContent getFile() {
return this.file;
}
}
什么是确切的问题。