我希望能够在我的 JSF 应用程序中下载 .txt 文件。我这样使用 h:command 按钮:
<h:commandButton value="Download" actionListener="#{exportBean.downloadFile}">
<f:attribute name="fileName" value="#{upload.name}"/>
</h:commandButton>
我在支持 bean 中使用此方法:http: //pastebin.com/BMAQSgTJ(该实现可能没问题,因为服务器返回我要下载的文件 - 可以在 firebug 输出中看到,我只粘贴它如果你是感兴趣的)
我的问题是,当我“单击” h:commandButton 下载文件时,没有保存或打开文件的对话框窗口......有人知道问题出在哪里吗?