Try this:
response.setContentType("text/csv");
response.setHeader("Content-Disposition","attachment; filename=\"" +
filename + "\"");
PrintWriter out = response.getWriter();

Alvin Chang wrote:


Hi,


I have a servlet which generates a comma separated value(CSV) file and
the browser will prompt a dialog so the user can save the output file
to a preferred location. It works fine on Netscape Navigator but when
I use IE6 I got the following error

"Internet Explorer was not able to open this Internet site. The
requested site is either unavailable ro cannot  be found.
 Please try again later".

I use the following statement
setContentType( "text/comma-separated" )
and I can get around it with
setContentType("text/plain");

but the browser will just display the plain text instead of a dialog box.

What MIME type shall I use so a dialog will prompt in both IE and
Netscape.

Thanks,

-Alvin Chang

___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html



Reply via email to