2016-08-19 55 views
1

我使用PF 5.3.5和Mojarra 2.2.8,我正在实现日志文件下载,但没有任何反应。primefaces文件下载XML5619:不正确的文档语法。行:1,列1

<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 任何帮助,评论真的很感激。提前致谢。

回答

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> 
相关问题