As far as I can tell it is impossible to get this working properly across
all browsers. Different browsers know about different MIME types, and even
then, some will randomly offer to save the file to disk or invoke Excel.
Some will pop up the "Open/Save" dialog twice, and sometimes Excel will
randomly fail to parse the same CSV file that it parsed just fine one minute
ago. Some will invoke Excel whether you want them to or not, depending on
which version of Excel, which browser, and as far as I can tell, the
alignment of the planets.
So pick the combination of headers (content-type, content-disposition, etc)
and filename, that seems to work best for your target users.
-----Original Message-----
From: Bert Dawson [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 25, 2001 3:00 PM
To: JRun-Talk
Subject: RE: serving up a csv...
Thanks, though "seems to work with most browsers" doesn't inspire
confidence...;)
I'll try the mapping thing, unless there's a good reason why i shouldn't...
Bert
ps
> From: Matthew L. Wright [mailto:[EMAIL PROTECTED]]
> Could you re-direct to the CSV file after processing had completed?
but i don't have a csv file - i just have a variable which contains the
info, and unless there's a newbie freindly way of writing it as a file then
serving that up, then i don't think thats an option...
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]
> Sent: 25 April 2001 18:52
> To: JRun-Talk
> Subject: RE: serving up a csv...
>
>
> There are a few tricks.
> 1. Use a servlet instead:
>
> http://myserver/servlet/csvserver/myfile.csv
>
> where the servlet is named csvserver. This one seems to work
> with most web
> browsers.
>
> 2. If you want to use a JSP, save the JSP page with an
> extension of .csv and
> then add this entry to web.xml:
>
> <servlet-mapping>
> <servlet-name>
> jsp
> </servlet-name>
> <url-pattern> *.csv
> </url-pattern>
> </servlet-mapping>
>
> -----Original Message-----
> From: Bert Dawson [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, April 25, 2001 1:19 PM
> To: JRun-Talk
> Subject: serving up a csv...
>
>
> I've got a jsp page that runs a report and has to serve the
> results in csv
> format, in which case it should be opened with excel (or whatever).
>
> I've got it to prompt me to "save file from current
> location/open it" by
> using the page directive contentType="unknown", but the file
> still has a jsp
> extension, so it opens in Jrun Studio - not ideal...
>
> Any ideas how i get it to open/save myfile.csv rather than
> myreport.jsp?
>
> Cheers
> Bert
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists