I think this is likely a JSP thing. A servlet response will provide either an output writer or stream, but not both. That exception you are getting is what happens when you try to open both for the same response. JSPs are not how I'd approach writing a servlet to serve something like a PDF -- just write a servlet and open the response output stream (and set the mime type) -- anything else is going to involve a fight with the JSP system.
Good luck,
Bob
On Friday, January 3, 2003, at 01:29 PM, Daniel Kalcevich wrote:
Has anyone been able to create a PDF document and then stream it to a JSP through the JSPWriter out?� I am trying to prompt the user to download the dynamic PDF I am creating (through a Taglib), and want to stream it back to the client using the JSPWriter.� I am using something similar to the following, and I can save the file ok without any errors, but when I go to view the file from my local machine, its blank. This is done inside an End Tag of a JSP Taglib.
...
byte[] bytes = baos.toByteArray();
for(int i = 0; i <bytes.length; i++)
{
��� pageContext.getOut().write( bytes[i] );
}
...
I can't use the getOutputStream because everytime I do, I get an IllegalStateException saying I can't use the getOutputStream() for this response.� Although if I do use it, it will throw the error to the console, but still allow me to download the file.� And when I do it this way, it saves the file correctly.� Any help on this would be greatly appreciated.� Thank you.
Daniel
