File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes Download Files in the MS Windows Operating System Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "Download Files in the MS Windows Operating System" Watch "Download Files in the MS Windows Operating System" New topic
Author

Download Files in the MS Windows Operating System

Daniel Gee
Ranch Hand

Joined: Aug 29, 2003
Posts: 202
The operating system in my PC is the MS Windows.

I use JSF and the Spring MVC framework.

How do I prompt the usual Windows dialog box, the box we have seen all the time, into the browser asking "Do you want to open or save this file?" with three buttons: Open, Save, and Cancel?

I am undertaking this task: users select "Generate MS Word Document" from a menu, which first invokes a method to retrieve requested information from the database and then uses some utility classes to format the information into a MS Word document. Thereafter, I prompt a dialog box into the browser asking users where in their local directory tree (i.e. the C: drive) the document is to be saved.

Thanks for advices.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Moving to the JSF forum.


Merrill
Consultant, Sima Solutions
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Just pass it as a file to the HttpServletResponse.

Basic example:getFilePath() and getFileName() are self-explaining.
They should look like "c:/path/to/file/filename.ext" and "filename.ext".
[ October 23, 2006: Message edited by: Bauke Scholtz ]

Code depot of a Java EE / JSF developer | JSF / Eclipse / Tomcat kickoff tutorial | DAO kickoff tutorial | I ♥ Unicode
JiaPei Jen
Ranch Hand

Joined: Nov 19, 2000
Posts: 1309
Thanks a lot for the explanation and the code.
 
I agree. Here's the link: jrebel
 
subject: Download Files in the MS Windows Operating System
 
Similar Threads
where word files are saved after downloading
How to open two .xls in the same request?
How to get open or save dialog in struts.
putting a printable word doc on website
urgently needed help