I have tried the following code and am getting rather strange behaviour. filename = "Download.qif"; inResponse.setContentType("text/plain"); inResponse.setHeader("Content-disposition", "attachment;filename=\"" + filename + "\""); inResponse.addHeader("Content-description", "My Description"); ServletOutputStream outStream = inResponse.getOutputStream(); downloadProcessor.writeData(outStream, transactionList, downloadData.getAccountNumber(), accountType, fromDate, toDate); outStream.flush(); outStream.close();
When I get the box the first time if I select to download to a file the filename is the same as my struts do action and the file contains the html from the screen that I am currently viewing. If I choose instead to view the data I then get another selection box and if I then choose to save to a file I get the correct data. Any ideas on what I am missing Thanks >>> [EMAIL PROTECTED] 10/04/01 01:14PM >>> The "always ask..." checkbox for me is checked and greyed. If I choose save to disk, then it saves fine and exits, but if I choose to open with an application, then the box comes up twice. Now, if webservers can create the proper headers for downloads, I should be able to as well. I just don't know the proper "open sesame" Tom At 02:24 PM 10/4/2001 -0400, you wrote: >Hi Tom, > >Not sure on how to stop it. Is it something to do with the checkbox on IE's >File Download dialog which says "Always ask..."? > >Dave > >PS I get 2 dialogs on netscape two! > > > > >Tom Tibbetts <[EMAIL PROTECTED]> on 10/04/2001 02:07:19 >PM > >Please respond to [EMAIL PROTECTED] > >To: [EMAIL PROTECTED] >cc: (bcc: David Hay/Lex/Lexmark) >Subject: Re: Struts capability to support file downloads > > > >Hi Scott. >not that I know of. I ended up grabbing the ServletOutputStream from the >response and streaming my file to the client that way. On the JSP, I >create a link that points to action mapping I've designated to do the >download. Remember to set the content type of the file. For the header, do >the following: > response.setHeader( > "Content-Disposition", > "attachment; filename=\"" + > fileName + > "\"" ); > >now, a question for all those who've done this before me. When I do this, >IE will pop up two dialog boxes in a row asking if I wish to save or open >an application to deal with the download. Netscape will just open up a >file save dialog box. Is there anyway to keep IE from doing the two dialog >boxes???: > > >At 11:47 AM 10/4/2001 -0600, you wrote: > >I noticed there is support in struts to allow a person to load a file > >from their local station to the server. > > > >Is there support to go the other direction? I have an application that > >allows the user to download data to a file on their local system. I > >would like to create the data on the server and then pop up a window to > >allow the user to select a location to store the data on their box. I > >would then stream the data to that file on their system. > > > >Any suggestions would be appreciated or pointers to other sites that > >might discuss this. > > > >Thanks > > > >Scott Ryan > >Developer > >First Bank Data Corporation > >Work: (303) 235-1485 > >Cell: (303 263-3044 Scott Ryan Developer First Bank Data Corporation Work: (303) 235-1485 Cell: (303 263-3044