ADF File Download – example

The operation af:fileDownloadActionListener in ADF provides a way to download file from server declaratively. This operation supports method binding where the method loads a file and send it to the user. This example, I have created a JSF page contains af:link component with af: fileDownloadActionListener ; when a user clicks on the link, it reads a text file from server and send it to user.

Download the project ADF File Download

ADF File Download – example started

1. Create an ADF Fusion Web application and create a jsf page in view project

2. Drop a af:link component into the page and add af:fileDownloadActionListener inside the link component. Bind a method property for af:fileDownloadActionListener that calls a backing bean method ‘downloadFIle The final JSF page looks like below

 

4. In the backing bean, create method as shown below with the two parameters FacesContext and OutputStream. This method loads a text file in the server and writes it on the OutputStream, which sends it to a user. That’s it

 

 

After running this application in the browser, it loads the JSF page like below. On Clicking on the link

090216_0130_1 ADF File Download – example

The file gets downloaded on the system. My browser supports the text file, so it displays the file on the browser.

090216_0130_2 ADF File Download – example

govindan ADF File Download – example
Connect me

Govind

Thank you for visiting my personal blog. Myself Govindan, Software Developer by profession since 2006 and hence I started this blog early in 2016 and ever since I've been writing about technologies experienced and learnings of everyday life.

The views expressed on this blog are my personal views and do not necessarily reflect the views of my employer.

Please feeling free to reach me on any comments and feedbacks you have. Would be more than glad to listen and reply 🙂
govindan ADF File Download – example
Connect me
Like us on Facebook.
Connect!