2016-08-19 38 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> 
相關問題