【发布时间】:2016-05-22 14:01:04
【问题描述】:
我想从数据库中检索文件并显示在 primefaces 数据表中。我使用此代码:
public StreamedContent getInputFileStreamedContent() {
if (this.document == null){
this.document = new byte[0];
}
InputStream inputStream = new ByteArrayInputStream(this.document);
return new DefaultStreamedContent(inputStream);
}
}
但是当我点击命令链接时,它返回 null。
Xhtml代码:
<p:column >
<f:facet name="header">
<h:outputText value="docId" />
</f:facet>
<h:commandLink value="#{o.userId}" rendered="#{o.inputFileStreamedContent != null}">
<p:fileDownload value="#{o.inputFileStreamedContent}"></p:fileDownload>
</h:commandLink>
</p:column>
【问题讨论】:
-
所以你是说这在数据表之外有效?
-
我不在数据表之外检查它
标签: jsf primefaces datatable download