Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Popup not closing when using the <af:fileDownloadActionListener>

Hi All,

I am using JDeveloper 12.2.1.4 .

My scenario is,

I have popup with <af:fileDownloadActionListener> component when user clicks the download button it will trigger the file download listiner and download the text docuemnt.

Download is working fine but after the download I tried to close the popup but I'm not able to close the popup.

My JSPX codes,

<af:commandButton text="DwonLoadPopup" id="cb2">
<af:showPopupBehavior popupId="p1" triggerType="action"/>
</af:commandButton>
<af:popup id="p1">
<af:dialog id="pgl2" resize="on" title="Downloadpopup">
<af:panelGroupLayout id="pgl3">
<af:commandButton text="Download" id="cb1">
<af:fileDownloadActionListener method="#{bean.doDownload}"
contentType="pdf"
filename="sample.pdf"/>
</af:commandButton>
</af:panelGroupLayout>
</af:dialog>
</af:popup>

Java Codes:

public void doDownload(FacesContext facesContext, OutputStream outputStream)
{
String data = "Download my contents";
try
{

 OutputStreamWriter writer = new OutputStreamWriter(outputStream, "UTF-8");  
 writer.write(data);  
 writer.close();  
 outputStream.close();  

}
catch(IOException e)
{
e.printStackTrace();
}

RichPopup pop =(RichPopup)facesContext.getCurrentInstance().getViewRoot().findComponent("p1");
pop.cancel();

}

Additionally I've used java script to hide my popup, but all went in vain.

Any suggestions will be appreciated.

Regards,

Radheshyam.

Comments