| Author |
Downloadinf a file from server
|
madupathi arun
Greenhorn
Joined: Feb 25, 2008
Posts: 23
|
|
hi i am having folowing problem I need to take the user specific directory and pass that to servlet file I am calling document.execCommand('SaveAs','1','filename.xml'); on the click of download button but I was unable to pass that file directory using this
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
|
How are you writing this DHTML out? Can you show us your servlet code?
|
JavaRanch FAQ HowToAskQuestionsOnJavaRanch
|
 |
madupathi arun
Greenhorn
Joined: Feb 25, 2008
Posts: 23
|
|
hi my requirement is to show saveas dialogue when i clickm on download button
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12921
|
|
What a browser does when a file of a certain type is sent to it by the server depends on the Content-Type HTTP header that's in the response. If Content-Type is set to "text/xml", then the browser will probably display it as an XML file. If the Content-Type is set to something that the browser doesn't recognise, then it will offer the user a Save As dialog box. If you set the Content-Type to "application/octet-stream" (which means: this is generic data), then it will most likely show you the Save As dialog box. So what you need to do is set the Content-Type HTTP header of the response before you send back the file from your servlet.
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
 |
|
|
subject: Downloadinf a file from server
|
|
|