Download attempt from servlet, returns "The page cannot be displayed". - Weblogic

This is a discussion on Download attempt from servlet, returns "The page cannot be displayed". - Weblogic ; Hello, we have a JSP which displays a report, and has a "download" gif, cliking on which, the form is submitted to a servlet, which is supposed to download the report as a xls file. Note that, no data file ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: Download attempt from servlet, returns "The page cannot be displayed".

  1. Download attempt from servlet, returns "The page cannot be displayed".


    Hello, we have a JSP which displays a report, and has a "download" gif, cliking
    on which, the form is submitted to a servlet, which is supposed to download the
    report as a xls file.
    Note that, no data file actually exists on the server, the servlet will fetch
    the data from database and stream it to client when download is clicked.
    The servlet code looks something like:
    //******* start code
    response.setHeader("Cache-Control","no-cache");//HTTP 1.1
    response.setHeader("Pragma","no-cache");//HTTP 1.0
    response.setDateHeader ("Expires", 0);//prevents caching at the proxy server
    String strFileName = "Test.xls";
    response.setHeader("Content-Disposition", "attachment; filename=\"" + strFileName
    + "\";");
    response.setContentType("application/vnd.ms-excel");
    javax.servlet.ServletOutputStream outStream = null; outStream = response.getOutputStream();

    outStream.println("Modules Report: Breakdown by Region/Branch"); outStream.flush();
    outStream.close();
    //******* end code
    But it does not download and instead give a "The Page cannot be displayed" error
    page.
    Why does this happen? If the setContentType code is removed, it pops up the dialogue
    box whihc has the open/save to disk option.
    Client is IE 5.5 on windows 2000 workstation
    Server is weblogic 6.1 on solaris 7
    Thanks...


  2. Re: Download attempt from servlet, returns "The page cannot be displayed".


    I am using NES as the webserver. Is any specific setting required in NES, so that
    it allows the servlet running in weblogic to download the files after changing
    the content type.

  3. Re: Download attempt from servlet, returns "The page cannot be displayed".


    I find these errors in the NES errors log, when I try to access the servlet whihc
    is supposed to do the download.
    'PROTOCOL_ERROR [line 651 of URL.cpp]: malformed header: LF doesn't follow CR'

    I'm getting this error from weblogic plug-in proxy on UNIX(Solaris). It work fine
    for NT environment/ I'mm using NES server 3.6.

    The servlet is returning a downloaded page in the HttpServletResponse. The content-type
    is set to "application/x-excel" before setting the response content.



  4. Re: Download attempt from servlet, returns "The page cannot be displayed".

    > Hello, we have a JSP which displays a report, and has a "download" gif,
    cliking
    > on which, the form is submitted to a servlet, which is supposed to

    download the
    > report as a xls file.

    ....
    > The servlet code looks something like:
    > String strFileName = "Test.xls";
    > response.setHeader("Content-Disposition", "attachment; filename=\"" +

    strFileName
    > + "\";");
    > response.setContentType("application/vnd.ms-excel");
    > javax.servlet.ServletOutputStream outStream = null; outStream =

    response.getOutputStream();
    >
    > outStream.println("Modules Report: Breakdown by Region/Branch");

    outStream.flush();
    > outStream.close();

    ....
    > But it does not download and instead give a "The Page cannot be displayed"

    error
    > page.
    > Why does this happen?


    Because instead of sending back an xls file, you are sending back the
    following bytes:

    "Modules Report: Breakdown by Region/Branch"

    That's not an excel spreadsheet.

    Peace,

    Cameron Purdy
    Tangosol, Inc.
    http://www.tangosol.com/coherence.jsp
    Tangosol Coherence: Clustered Replicated Cache for Weblogic


    "vinay s" wrote in message
    news:3f0d6888@newsgroups.bea.com...
    >




+ Reply to Thread