Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Download Files in the MS Windows Operating System

 
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to the JSF forum.
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot for the explanation and the code.
 
Today's lesson is that you can't wear a jetpack AND a cape. I should have read this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic