File Open: Asks twice to open attachments in IE6.0

Discussions

Web tier: servlets, JSP, Web frameworks: File Open: Asks twice to open attachments in IE6.0

  1. File Open: Asks twice to open attachments in IE6.0 (1 messages)

    HI,

    I went through previous postings on this issue, but there were no exact answer or exact cause for this issue and hence I am posting this again: Issue: I am trying to open some documents in my JSP where a BLOB will be streamed and written to ServletOutputStream. Some piece of code which does this, I have pasted below:

    // start attachmentviewer.jsp
    <% BufferedInputStream is = null;
    BufferedOutputStream os = null;
    response.setContentType(mimeType.trim()); // say application/msword for word document
    response.setHeader("Content-Disposition","attachment; filename=\""+attachmentViewBean.getAttachmentName()+ "\";"); //bean method gets attachment name
    is = new BufferedInputStream(attachmentViewBean.getAttachment().getBinaryStream()); // gets blob
    os= new BufferedOutputStream(response.getOutputStream());
    byte[] buff = new byte[6500];
    int bytesRead;
    out.clearBuffer();
    while(-1 != (bytesRead = is.read(buff, 0, buff.length)))
    {
    os.write(buff, 0, buff.length);
    }
    %>
    // end attachmentviewer.jsp
    I am closing handles etc. after this.
    This works fine in Netscape6.0 in which
    a dialog box prompts user to open/save
    document once and does correspondigly
    after user action.
    In IE 6.0 first file open dialog comes
    informing its open/saving
    attachmentviewer.jsp. Upon clicking open it
    again opens another dialog box
    informing to open/save for actual file
    name put in response's setHeader method.
    I observed this to happen in IE6.0, but
    works fine in IE5.5 prompting user once.
    If anyone has any idea/suggestions/tips
    about this, please lemme know.

    Thanks,
    Yogesh
  2. sounds like a browser issue and not your code

    i've seen this behaviour on other sites I've downloaded from, so I don't think you should worry.