JSP unable to stream CSV file back to browser in binary - Weblogic

This is a discussion on JSP unable to stream CSV file back to browser in binary - Weblogic ; Hi, I'm trying to stream CSV (comma separated values) file created on the server back to the browser. It is spitting out file contents in the browser instead of prompting the user for open or save as dialogue box. please ...

+ Reply to Thread
Results 1 to 6 of 6

Thread: JSP unable to stream CSV file back to browser in binary

  1. JSP unable to stream CSV file back to browser in binary

    Hi,
    I'm trying to stream CSV (comma separated values) file created on the
    server back to the browser. It is spitting out file contents in the
    browser instead of prompting the user for open or save as dialogue box.


    please advise.

    below is the snippet
    <%

    StringBuffer results = new StringBuffer();
    results.append("Name,General,Version,Size,Modified
    mybookmarks.htm,Test ");
    results.append("document,1.0:CURRENTRAFT V1.0,68 KB,2/3/2006
    16:45:35");

    response.setContentType("application/octet-stream");
    response.setHeader("Content-Disposition",
    "attachment;filename=results.csv");
    response.resetBuffer();

    ServletOutputStream myOut = response.getOutputStream();
    myOut.write(results.toString().getBytes());
    myOut.flush();
    myOut.close();

    %>


  2. Re: JSP unable to stream CSV file back to browser in binary

    Try application/vnd.ms-excel as the content type. It should work.
    Here's my c# code that works, http://www.csvreader.com/csv_samples.html


  3. Re: JSP unable to stream CSV file back to browser in binary

    The solution you suggested did not work either.
    It spits the same below out in the browser. Its supposed to be very
    simple JSP page .. nuthing complex.

    Name,General,Version,Size,Modified mybookmarks.htm,Test
    document,1.0:CURRENTRAFT V1.0,68 KB,2/3/2006 16:45:35


  4. Re: JSP unable to stream CSV file back to browser in binary

    what browser are you using?

    is there any security on the browser to prevent malicious code from
    streaming?



    "abby" wrote in message
    news:1139007269.336157.42960@o13g2000cwo.googlegro ups.com...
    > The solution you suggested did not work either.
    > It spits the same below out in the browser. Its supposed to be very
    > simple JSP page .. nuthing complex.
    >
    > Name,General,Version,Size,Modified mybookmarks.htm,Test
    > document,1.0:CURRENTRAFT V1.0,68 KB,2/3/2006 16:45:35
    >




  5. Re: JSP unable to stream CSV file back to browser in binary

    I'm using IE. Nope it does not have any security restrictions on it to
    prevent pop-up or malformed script.


  6. Re: JSP unable to stream CSV file back to browser in binary

    one of my coworkers was having a streaming issue with adobe

    i thought he mentioned that there was a patch put in place by microsoft to
    prevent streaming to browswer

    becuase of a security hole

    not exactly clear on the issue but it sounds very similar

    that is my only guess

    and i have no validation to this theory

    other than hearsay at the office

    "abby" wrote in message
    news:1139253397.288609.231380@g43g2000cwa.googlegr oups.com...
    > I'm using IE. Nope it does not have any security restrictions on it to
    > prevent pop-up or malformed script.
    >




+ Reply to Thread