File download dialog box problem!


Web tier: servlets, JSP, Web frameworks: File download dialog box problem!

  1. File download dialog box problem! (2 messages)


    How do you force file download message box to use specified file name instead of JSP or servlet name.

    I am using:

    // code in attachment.jsp
    response.setHeader("Content-Disposition","attachment;filename=\""+attachmentViewBean.getAttachmentName()+ "\"");

    With the above code, browser first pop up file download dialog box informing
    'You are downloading the file:[attachment.jsp] from host. Would u like to open the file or save?'

    I want the file name that I had specified in setHeader("Content-disposition","attachment;filename=resume.doc") to appear(i.e. resume.doc) in above dialog box and not the servlet name.

    Any suggestions/tips on this?

    Your help would be greatly appreciated.

  2. File download dialog box problem![ Go to top ]

    Interesting, so you are using a servlet to get the attachment?

    You could perhaps map the file name to the right servlet URL in web.xml configuration, and then use it from the web page...the browser thinks it is getting a file, but the server maps the request appropriately.
  3. File download dialog box problem![ Go to top ]

    Actually, its not a physical file residing on disk that I am trying to display. Its a database BLOB that I am straming it to JSP page and I dont want to download it to disk for dislay purpose. One more thing, I am doing all this in servlets superset(i.e. JSP).

    Any other alternative idea/tips?