  | | | Subject: Excel, Struts and Downloading | Subject: Excel, Struts and Downloading 2007-05-27 - By Jon Wynacht
Back Hi,
I used to run Struts 1.2.9, POI 2.5 and could generate Excel files from a servlet and download them without issue. I recently upgraded to Struts 1.3.5 and POI 3 and it looks like I broke that capability. I'm getting the following error:
java.lang.IllegalStateException: getOutputStream() has already been called for this response
I've searched through the Net and the archives here for info but nothing really seems to fit for my situation; it's mostly JSP.
I'm calling an Action servlet which makes a call to the model and gets some data, creates a new workbook and then does this:
<snip> response.setContentType("application/vnd.ms-excel"); response.setHeader("Content-disposition", "attachment;filename=\"attendees.xls\""); response.addHeader("Content-description", "Event Attendees"); ServletOutputStream stream = response.getOutputStream (); wb.write(stream); stream.close(); ... forward = "SUCCESS"; ... return mapping.findForward(forward); </snip>
It's what I did before I upgraded and things worked fine. Now they don't
Any ideas? Am I missing something really obvious or was I bending the rules a bit and taking chances with my data in my previous config?
Cheers and thanks,
Jon
Jon Wynacht jon@(protected) http://www.objectevolution.com
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ To unsubscribe, e-mail: poi-user-unsubscribe@(protected) Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
|
|
 |