This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JSF and the fly likes Download files component Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Download files component" Watch "Download files component" New topic
Author

Download files component

Mary Cole
Ranch Hand

Joined: Dec 02, 2000
Posts: 362
Hi,
Is there a component/sample code to download files from a web page using JSF?

Please advice
Jason Lee
Greenhorn

Joined: Mar 03, 2008
Posts: 12
Originally posted by Mary Cole:
Hi,
Is there a component/sample code to download files from a web page using JSF?

Please advice


Off hand, assuming I understand your request, I know of two such components. One is my own download component in the Mojarra Scales project: https://scales.dev.java.net/#download with a live demo here: http://jsftemplating.org/mojarra-scales-demo-facelets/download.jsf

RichFaces/Ajax4Jsf also offers a4j:mediaOutput: http://labs.jboss.org/file-access/default/members/jbossrichfaces/freezone/docs/devguide/en/html/RichFacesComponentsLibrary.html (section 6.12) and a live demo of that here: http://livedemo.exadel.com/richfaces-demo/richfaces/mediaOutput.jsf


Jason Lee, SCJP
Senior Member of Technical Staff with Oracle
http://blogs.steeplesoft.com
Mary Cole
Ranch Hand

Joined: Dec 02, 2000
Posts: 362
I didn't get much info from both the sites...actually, I have a filename (.pl or .zip , or .doc) with a hyperlink ( a command link ) to it on the web page..on click of the link, it should call the method on the bean to get the file contents and display the save open dialog box so that the user can view or downlad the file.. if possible I would prefer not to refresh the page..Ajaxit

any suggestions?

[ March 25, 2008: Message edited by: Mary Cole ]
[ March 25, 2008: Message edited by: Mary Cole ]
Ketan Jambhekar
Ranch Hand

Joined: Mar 26, 2007
Posts: 37
Hi,
i dont think you need any special components to acheive this functionality.
You can use the link as a commandLink and call a method which does the following


You need to write your own custom methods whereever applicable in the above scenario.

Thanks,
Ketan.
 
Consider Paul's rocket mass heater.
 
subject: Download files component