【发布时间】:2012-09-15 06:31:12
【问题描述】:
当我实现 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;
}
}
具体的问题是什么。
【问题讨论】:
-
把
public FileDownloadController() {改成public void FileDownloadController() { -
如果更改像您建议的 IDE 显示警告“更改为构造函数”
-
请选择一个答案作为正确答案。
标签: primefaces download