Robert et al- Check out this DownloadServlet example at http://www.experts-exchange.com/Web/Web_Languages/JSP/Q_20842012.html HTH, Martin- ----- Original Message ----- From: "Robert Shields" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, September 22, 2004 4:59 AM Subject: RE: File Download
Hi, One way to do this is to set a header named content-disposition with a value of attachment;filename=download.txt So the raw http header would look like this: content-disposition: attachment;filename=download.txt This will cause your browser to open the standard open/save dialog. How you set the header is another story! Maybe use a servlet-mapping to map download.txt to a servlet and call response.addHeader from that servlet. Regards Rob -----Original Message----- From: Shailender Jain [mailto:[EMAIL PROTECTED] Sent: 22 September 2004 09:28 To: [EMAIL PROTECTED] Subject: File Download Hi All, Sorry if this slightly offline from the topic. I want to give a download link on my browser to the user so that he can download a test file from the server and save it into his local machine I have given a hyperlink to the user which points directly to the file (download.txt) But the problem is instead of downloading the file the contents of the file get displayed in the browser. What is the best way i can accomplish this? Any help in Struts for doing this? Thanks Shailende Jain ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]