Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Download Files in the MS Windows Operating System

 
Daniel Gee
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to the JSF forum.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
JiaPei Jen
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot for the explanation and the code.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!