It's not a secret anymore!
The moose likes JSP and the fly likes Saving a file on the client's machine Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Saving a file on the client Watch "Saving a file on the client New topic

Saving a file on the client's machine

prabhakar pullela

Joined: Mar 07, 2007
Posts: 7
How to Save a file at the client place using JSP.

[BPSouther: Added meaningful subject line]
[ March 15, 2007: Message edited by: Ben Souther ]
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

Some advice: you'll get a better response if you use a meaningful subject line. Also, in order that those for whom English is not their first language have a better chance of understanding what is posted in these forums, we ask that you refrain from using words that are not recognized English, such as "plzzzzzzzzzz". Also, you might benefit from reading this.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

In short, you can't.
Browsers, for security reasons, don't allow this.

What you can do, is set the Content-Type and Content-Disposition headers in such a way that the browser will prompt the user with a "Save As" dialog box.

See our JspAndExcel entry in the JSP FAQ page for an example that does this.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
I agree. Here's the link:
subject: Saving a file on the client's machine
It's not a secret anymore!