ICEfaces libary in classpath prevents Save As dialog from popping up on file download

▼魔方 西西 提交于 2019-11-27 09:50:00

You can't download files using ajax.

Ajax is under the covers executed by JavaScript's XMLHttpRequest object. The request will be successfully executed and the response will be successfully retrieved. However, JavaScript has no facility to write the response to client's disk file system, nor to force a Save As dialogue with the given response. That would be a huge security breach.

The cause of your concrete problem is ICEfaces itself. Namely, when you integrate ICEfaces in a JSF web application, all standard <h:commandXxx> links/buttons will silently be turned into ajax-enabled ones which indeed causes confusion among starters. Make sure that the download link/button isn't implicitly using ICEfaces-introduced ajax facility. As per their wiki page on the subject, you need to explicitly nest a <f:ajax disabled="true"> to disable this.

Disable Ajax for a Component

You can also disable Ajax at the level of the individual component:

<h:commandButton value="Send" actionListener="#{bean.sendMessage}">
    <f:ajax disabled="true"/>
</h:commandButton>

Apply it on your download link/button.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!