Jsf 如何使用Primefaces下载多个文件

Jsf 如何使用Primefaces下载多个文件,jsf,primefaces,Jsf,Primefaces,我有一个数据表,用户将从该表中选择一些文件,当他单击“下载”按钮时,他将下载这些文件。下面的代码工作得很好,但这里有一个InputStreamList,您可以在这里看到,不仅第一个流,还必须下载其他流。有什么想法吗 这是我的控制器方法 StreamedContent file; public void downloadFile(){ InputStream stream = streamList.get(0); file = new DefaultStreamedContent

我有一个数据表,用户将从该表中选择一些文件,当他单击“下载”按钮时,他将下载这些文件。下面的代码工作得很好,但这里有一个InputStreamList,您可以在这里看到,不仅第一个流,还必须下载其他流。有什么想法吗

这是我的控制器方法

StreamedContent file;

public void downloadFile(){
    InputStream stream = streamList.get(0);
    file = new DefaultStreamedContent(stream, "xml", getRandomName());
}
我的观点

<p:commandButton value="Download"
                         ajax="false"
                         actionListener="#{myController.downloadFile()}"
                         icon="ui-icon-disk">
            <p:fileDownload value="#{myController.file}" />
        </p:commandButton>

使用Javascript在每个文件上模拟onClick事件

显示文件
@BalusC如何将其作为zip提供?
 <p:commandButton  value="Download" ajax="false"  icon="ui-icon-arrowthick-1-s" styleClass="foo">
         <p:fileDownload value="#{fileDownloadView.file}" />
  </p:commandButton>
<p:commandButton value="DownloadAll" ajax="false" onclick="start()" icon="ui-icon-arrowthick-1-s"/>
function start() {                    
                    var buttons = $(".foo");
                    $(buttons).each(function(){
                    $(this).click();
                     });             

                    }