开发者

h:command button oncomplete action

开发者 https://www.devze.com 2023-03-11 05:57 出处:网络
When downloading file from server if i usea4j:commandLinkfile download fail(mean file written to browser screen) if i use h:commandLink it is okay.I want to show a rich modal panel when file downloadi

When downloading file from server if i use a4j:commandLink file download fail(mean file written to browser screen) if i use h:commandLink it is okay.I want to show a rich modal panel when file downloading but standard components not have a on complete action so i cant hide modal panel after file downloaded .How can i workaround this issue,I am using rich faces 3.3

  <h:commandLink value="Download"
   action="#{logSearcher.downloadFile}" 
  onclick="Richfaces.showModalPanel('ajaxLoadingModalBox',{width:450, top:200})"
                                   immediate="true" >
                          <f:setPropertyActionListener value="#{log}"
                            target="#logSearcher.selectedLogLine}"   
  开发者_运维知识库                                  />                          
  </h:commandLink>


You can use de rich:componentControl or the JS API show function (#{rich:component('mp')}.show).

http://livedemo.exadel.com/richfaces-demo/richfaces/modalPanel.jsf?s=blueSky#


The <a4j:commandLink> sends by default an asynchronous (ajax) request. You cannot download files using asynchronous requests. JavaScript simply does not offer facilities to turn a XMLHttpRequest response into a Save As dialog. You need to download files using a normal synchronous request. The <h:commandLink> does that.

Your best bet is to use the onclick attribute of <h:commandLink> to close the modal panel. If necessary with a setTimeout().

0

精彩评论

暂无评论...
验证码 换一张
取 消