Hi Peter,

Apart from the file name, the only difference between your suggestion and what I am 
doing is that :-
    1) your Java code is in a JSP, while mine is in an Action form
    2) you are using "text/csv" as the content type, while mine is "application/msword"

Perhaps by having my code in an Action form, something within Struts/Tomcat etc. 
decides that it isn't appropriate to allow me to set the Content-Disposition and 
Content-Description response headers (as I am processing a request from the user) and 
is ignoring them.  So when the OutputStream is flushed later on, the browser just gets 
a stream of data without those headers.

As soon as I can, I had better test whether using a JSP allows me to influence the 
browser captions and suggest the file name when downloading Word documents.

Regards.

Mike

-----Original Message-----
From: Peter Hilton [mailto:[EMAIL PROTECTED]
Sent: 08 December 2003 09:51
To: 'Struts Users Mailing List'
Subject: RE: Setting browser download dialogue box captions and
suggesting file names


To make a JSP respond as a CSV download I start the JSP like this:

<%
        response.setContentType("text/csv");
        response.setHeader("Content-Disposition", "attachment;
filename=some-data.csv");
%>

For Word, you probably need this:

<%
        response.setContentType("application/msword");
        response.setHeader("Content-Disposition", "attachment;
filename=my-document.doc");
%>

Peter Hilton
____________________________
LogicaCMG
Kralingseweg 241-249
Postbus 8566
3009AN Rotterdam
The Netherlands
www.logicacmg.com

All opinions expressed are solely those of the author and not of LogicaCMG


-----Original Message-----
From: Mike Parfitt [mailto:[EMAIL PROTECTED]
Sent: 01 December 2003 11:42
To: [EMAIL PROTECTED]
Subject: Setting browser download dialogue box captions and suggesting
file names

[...] When a user clicks on one, a request is made to the server passing in
the ID of the chosen file (Microsoft Word) to be downloaded. [...] The file
is then downloaded to the user's browser (Internet Explorer - V5) but I
cannot find how to influence the caption/contents of the various dialogue
boxes [...] 
 
 
Mike Parfitt 
Developer 
JMH Demica Ltd 
Crowne House,
56-58 Southwark Street 
London 
SE1 1UN 

 
 
 
Direct:      +44 (0) 20 7450 2539 
Switchboard: +44 (0) 20 7450 2500 
Fax:         +44 (0) 20 7407 5825 
Web:         http://www.jmhdemica.com 
 
 
 
This document should only be read by those persons to whom it is 
addressed and is not intended to be relied upon by any person 
without subsequent written confirmation of its contents. JMH 
Demica accepts no liability for the consequences for any person 
acting, or refraining from acting, on such information prior to 
the receipt by those persons of subsequent written confirmation 
(by letter or fax). If you have received this email message in 
error, please notify the sender immediately by telephone. Please 
also delete the message from your computer. Any form of 
reproduction, dissemination, copying, disclosure, modification, 
distribution and/or publication of this email message is 
prohibited. The contents of this email message do not 
necessarily reflect the opinions of JMH Demica. Citadel is the 
registered trademark of JMH Demica. Copyright JMH Demica all 
rights reserved. 

 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to