Hi Emi,
maybe this will help a little:
http://struts.apache.org/2.2.1/docs/stream-result.html

Best greetings,
Paweł Wielgus.


2011/3/23 Emi Lu <em...@encs.concordia.ca>:
>>
>> 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: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to