A question about struts2 + PDF. Struts2 + itext5.x.
In action class:
==========================================
HttpServletResponse res = ServletActionContext.getResponse();
res.setContentType("application/pdf");
Document document = new Document();
PdfWriter.getInstance(document,
res.getOutputStream());
document.open();
...
document.close();
Always got the following errors:
====================================
ERROR tags.BaseSimpleTag.doEndTag:? - ERROR: getOutputStream() has
already been called for this response
org.apache.catalina.core.ApplicationDispatcher invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.IllegalStateException: getOutputStream() has already been
called for this response
> Also, how do you setup the default PDF file name?
I fixed the above by trying the following:
(1) Change action class to void
(2) Added response.setHeader("Content-disposition","attachment;
filename=\"" + reportName + ".pdf\"" );
Is there a way to fix it and is there any good online doc about how
struts2 + itext pdf file generation?
I'd like to get some good online docs about struts2 + jsperreport, or
struts2 + itext pdf generation.
Thanks alot!
Emi
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]