primefaces 文件下载 XML5619:文档语法不正确。行:1,第 1 列
primefaces fileDownload XML5619: Incorrect document syntax. Line: 1, Column 1
我正在使用 PF 5.3.5 和 Mojarra 2.2.8,我正在执行日志文件下载,但没有任何反应。
<p:commandButton value="#{msg.SUPPORT_DOWNLOAD_APP_PROPS}" title="#{msg.SUPPORT_DOWNLOAD_APP_PROPS} (d)" accesskey="d">
<p:fileDownload value="#{supportController.downloadProperties}" />
</p:commandButton>
和后端
public StreamedContent getDownloadProperties() {
StreamedContent file = new DefaultStreamedContent();
ByteArrayOutputStream bos = null;
try {
bos = new ByteArrayOutputStream();
propConf.save(bos);
InputStream is = new ByteArrayInputStream(bos.toByteArray());
if (is != null)
file = new DefaultStreamedContent(is);
if (LOG.isDebugEnabled()) {
LOG.log(Level.DEBUG, "Download Prop: " + bos.toString());
}
return file;
} catch (ConfigurationException e) {
LOG.error("Could not save the collected properties", e);
} finally {
IOUtils.closeQuietly(bos);
}
return file;
}
我在 IE11 控制台中看到没有下载文件,只有下面这个错误,在 Mozilla 控制台中是这个错误 语法错误 app-info.xhtml:1:1 并且没有后端错误。
XML5619:文档语法不正确。行:1,第 1 列
非常感谢任何帮助和评论。提前致谢。
我把p:commandButton的属性设置为ajax="false"
解决了。
<p:commandButton value="#{msg.SUPPORT_DOWNLOAD_APP_PROPS}" title="#{msg.SUPPORT_DOWNLOAD_APP_PROPS} (d)" accesskey="d" ajax="false">
<p:fileDownload value="#{supportController.downloadProperties}" />
</p:commandButton>
我正在使用 PF 5.3.5 和 Mojarra 2.2.8,我正在执行日志文件下载,但没有任何反应。
<p:commandButton value="#{msg.SUPPORT_DOWNLOAD_APP_PROPS}" title="#{msg.SUPPORT_DOWNLOAD_APP_PROPS} (d)" accesskey="d">
<p:fileDownload value="#{supportController.downloadProperties}" />
</p:commandButton>
和后端
public StreamedContent getDownloadProperties() {
StreamedContent file = new DefaultStreamedContent();
ByteArrayOutputStream bos = null;
try {
bos = new ByteArrayOutputStream();
propConf.save(bos);
InputStream is = new ByteArrayInputStream(bos.toByteArray());
if (is != null)
file = new DefaultStreamedContent(is);
if (LOG.isDebugEnabled()) {
LOG.log(Level.DEBUG, "Download Prop: " + bos.toString());
}
return file;
} catch (ConfigurationException e) {
LOG.error("Could not save the collected properties", e);
} finally {
IOUtils.closeQuietly(bos);
}
return file;
}
我在 IE11 控制台中看到没有下载文件,只有下面这个错误,在 Mozilla 控制台中是这个错误 语法错误 app-info.xhtml:1:1 并且没有后端错误。
XML5619:文档语法不正确。行:1,第 1 列 非常感谢任何帮助和评论。提前致谢。
我把p:commandButton的属性设置为ajax="false"
解决了。
<p:commandButton value="#{msg.SUPPORT_DOWNLOAD_APP_PROPS}" title="#{msg.SUPPORT_DOWNLOAD_APP_PROPS} (d)" accesskey="d" ajax="false">
<p:fileDownload value="#{supportController.downloadProperties}" />
</p:commandButton>