jsf - How to perform commandLink's action method before filedownload in commandLink? -
codes:
<p:dialog header="downloads" widgetvar="hwdialog" modal="true" showeffect="fade" hideeffect="fade" resizable="false" appendto="@(body)" width="700" height="500" position="center center"> <p:ajax event="close" listener="#{mb.selectedreset()}" update="@([id$=hwtable])" /> <h:form id="dlg_form"> <p:datatable id="dlg_hwtable" var="std" value="#{mb.list}" paginator="true" rows="10" rowkey="#{std.id}" rowsperpagetemplate="5,10,15" rowindexvar="count"> <p:column headertext="file"> <p:commandlink ajax="false" value="download" action="#{mb.preparefordownload(std)}"> <p:filedownload value="#{mb.file}" /> </p:commandlink> </p:column> </p:datatable> </h:form> </p:dialog>
file null at first click in p:filedownload.then dialog closes unexpectedly.unexpectedly because close event doesn't work when dialog closed.but re-opening dialog , clicking link again.works downloading previous file.so filedownload performed before commandlink's action method.how can solve problem?
you need use actionlistener
prepare file stream p:filedownload
, because action
method gets triggered after downloading logic executes.
fix dissappearing dialog - happening because without file download request resulted in non-ajaxical post navigation, resets page dom initial state.
Comments
Post a Comment