• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to create a new file into client side

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello, I will try to be clear with my english...

I want the user on the client side to be able to save the results shown in the JSP page to a new XLS file.

When he clicks on a button, a popup appears (like "file-save as" standard in web pages), User choose his folder and gives the name of the file to be created.
My servlet will generate the result file with the name input by the user into his folder using outputStream class.

What is the way to able the user to choose his folder ? I can't use "input type file" because the file must exist with this input type.

I hope my request to be clear...

Thank you for your help.
Mariane
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When the button is clicked, submit to a servlet that streams the file to the browser with the appropriate content-type and content-disposition headers. The browser will take care of everything else.

Search this and the Servlets forum for terms like "content-disposition" for concrete examples.
 
Maresq Mariane
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for your quick answer, but, what I really need is

what kind of "button" or "input type" can I use to make the same think that "File -save as" : Go to client directories, choose the good one etc...

It is not "input type="file" , because file must already exist.

Do you know the html method to do this ?

Regards,

Mariane
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's not something that's done on the HTML side.

As bear mentioned, the "Content-Disposition" header coming from the server is what triggers that.
 
Maresq Mariane
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, thank you very much, I didn't understand the first time, but know, I just tryed to use "content-disposition" and it works fine.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic