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!

Unable to open ADF file once downloaded with FileDownloadActionListener.

840491Feb 17 2011 — edited Feb 18 2011
Hello Friends,
I have developed an application in which there is one command button and on click of that I am trying to download PDF file. File is getting downloaded successfully but when I am trying to open that file, it
s giving me an error something like "could not open file.pdf beacuse either not supported or file has been damaged."

In JSF this is what I have written :

<af:commandButton text="Download" id="cb1">
<af:fileDownloadActionListener filename="Download.pdf"
contentType="application/pdf"
method="#{SampleBean.downloadPDF}"/>
</af:commandButton>

In my Bean I ve written something like this :

public class SampleBean {
public SampleBean() {
}

public void downloadPDF(FacesContext facesContext,
OutputStream outputStream) throws IOException {
OutputStreamWriter w = new OutputStreamWriter(outputStream, "UTF-8");
w.write("Hi there!");
w.flush();
}
}

FileDownloadActionListener does not support PDF formate?
I dont know where I am getting wrong or missing something. Any help or suggestion is appriciated.

Thanks in advance !! :)
cheers,
Sheetal.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 18 2011
Added on Feb 17 2011
3 comments
934 views