hi all, I'm a newbie, so I lack experience on solving some errors, I really appreciate if you help me to solve this.
I got a error
I tried to implement iReport into my web project. I used Netbean to create the project.
I have 2 classes: ConnectionManager.java and JaperReportWrapper.java
The first one is used to connect with the database, I can handle it.
The second one is used to connect the database with iReport and some method to compile a JRXML file and export into a PDF file.
I also created a jsp file: CustomerInvoicesReports.jsp
Here is this:
Maybe the errors occurred at this line
Because when I deleted it, the error disappeared.
Any body help me, please. I really appreciate this.
PS: The JasperReportWrapper.java is following:
You are trying to mix text (the automatic variable "out", which is used for the HTML start, and even the line breaks after your JSP directives) with binary (response.getOutputStream()). That's not going to work. Instead try JRExporterParameter.OUTPUT_WRITER combined with that automatic variable "out":
So you want to create a PDF file? Then drop most of that page. That is generating HTML; check the content type.
What you would need to do to generate PDF from a JSP is this:
1) set the proper content type
2) do not use any text, including text between JSP directives and/or other JSP tags
3) use response.getOutputStream() again
Step 2 is very important, as without it the JSP file will use the default JspWriter instead of OutputStream, and you will get your error again.
Or, the simpler approach, use a servlet instead of JSP.