RE: Downloading a file from an Action class.

2004-06-10 Thread Wang, Yuanbo
ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(baos); ps.print(new String(returnStr)); ServletOutputStream sos = response.getOutputStream(); baos.writeTo(sos); sos.flush(); sos.close(); Then return null ActionForward in your action method. Thanks, Yuan

RE: Downloading a file from an Action class.

2004-06-10 Thread Frank Zammetti
The problem I think is that you are never writing your output to the Response object. I'm guessing you think that setting the filename in the header as you are doing will be sufficient, but it's not. Try something along these lines: ServletOutputStream out = response.getOutputStream(); ba.wri

Re: Downloading a file from an Action class.

2004-06-10 Thread Niall Pemberton
Miquel, All you are doing is writing out a file on your server and then sending back an empty response to the user - if you want to download the file, you need to write it out to the response. Try creating your file by writing it to a ByteArrayOutputStream, rather than FileOutputStream ByteAr