Tahir,
It had to do with my forward and the fact that the response was
already handled. I emailed the struts user list and they took care of
things for me.
Thanks for the pointers!
Cheers,
Jon
On May 28, 2007, at 3:17 AM, Tahir Akhtar wrote:
OTH, if the stacktrace suggests the exception originates at the line
containing response.setHeader/response.setContentType the problem
might be
upstream.
In both cases the struts users list will be more helpful than poi.
Regards,
Tahir Akhtar
-----Original Message-----
From: Tahir Akhtar [mailto:[EMAIL PROTECTED]
Sent: Monday, May 28, 2007 1:07 PM
To: 'POI Users List'
Subject: RE: Excel, Struts and Downloading
Hi Jon,
I am no struts expert but I think your problem lies in trying to do a
forward after the writing to servlet output stream (through poi). You
should
not try to send a redirect after generating content on a stream.
I don't know why it was working with older version of struts. Have
you
changed your action mappings during the upgrade?
May be you can get some ideas from here
http://wiki.apache.org/struts/StrutsFileDownload
Regards,
Tahir Akhtar
-----Original Message-----
From: Jon Wynacht [mailto:[EMAIL PROTECTED]
Sent: Monday, May 28, 2007 2:57 AM
To: poi-user@jakarta.apache.org
Subject: Excel, Struts and Downloading
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
[EMAIL PROTECTED]
http://www.objectevolution.com
--------------------------------------------------------------------
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Jon Wynacht
[EMAIL PROTECTED]
http://www.objectevolution.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/