that seems to do the trick - thanks...
except sometimes it doesn't seem to work:

index.jsp:
    case "run_report"
       <jsp:include page="act_runreport.jsp">


act_runreport.jsp:

switch
    case "give_me_html"
        dump the html on the screen
    case "give_me_csv"
        <jsp:forward page = "serve_as_csv.jsp">


serve_as_csv.jsp:

<%@ page contentType="unknown"%>
<% response.setHeader("Content-Disposition", "inline; filename=foo.csv"); %>
"fee","fi","fo"


When i do the above, then the csv (fee, fi fo) gets shown in the browser,
but if i ship out the index.jsp, and call run_report directly then it works
(ie i get preompted to save or open with excel.

I suspect this is because the default response header has already been set
somewhwere along the way....
If so, is there a way i can stop this response being sent?
Or is this something to do with flushing/buffer?
and if its something else, then what is it?

Thanks for all your help

Bert

CF developer (yes, really)
jsp developer (not really!)


> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: 25 April 2001 20:36
> To: JRun-Talk
> Subject: RE: serving up a csv...
> 
> 
> Have to set the content-disposition header...
> 
> // the following one makes it come up with a save as or open 
> from dialog
> // response.setHeader("Content-Disposition", "attachment; 
> filename=" + file_name);
> // the following does it inline as thought you were to click 
> a link normally
> response.setHeader("Content-Disposition", "inline; filename=" 
> + file_name);
> 
> Travis Reeder
> Chief Software Architect
> ThinkVirtual
> 
> 
> ---- Original Message ----
> From: Bert Dawson <[EMAIL PROTECTED]>
> Sent: 2001-04-25 11:18:33.0
> To: JRun-Talk <[EMAIL PROTECTED]>
> 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

Reply via email to