Apache FOP with Struts
Posted on 2004-08-19
I'm trying to get my Struts Action class to generate a PDF response using Apache FOP. I'm pretty new to FOP and not a Struts expert. So far, what I've done in my Action class's execute() method is:
Driver driver = new Driver(new org.xml.sax.InputSource("foo.fo"), response.getOutputStream());
This was taken pretty much straight from the FOP with Servlets example.
The exception I'm getting is:
java.lang.IllegalStateException: getOutputStream() has already been called for this response
I did expect to get an exception because I was just stabbing in the dark and wanted to see if I could get some kind of PDF output happening, but if anyone could either tell me whats wrong here or guide me in using FOP with Struts I'd be really grateful.