Jasperreports is an open-source Java report generation engine. ireport is a GUI tool of jasperreports to generate jrxml files of jasperreports.
Java calls jasperreport must be imported jar package: jasperreports-x.x.jar, commons-logging-x.x.jar, itext-x.x.jar, itextasian. jar.
To use ireport in JSP
1. Set database connection parameters in ireport in Database
Set the report Condition Parameters in parameters for SQL statements in the database.
Write an SQL statement, obtain the fields to be displayed from the Database Based on the condition parameters, and fill them in the database.
On the ireport main interface, design the report format and set the displayed field parameters.
Compile and generate a. Jasper File
2. input parameters in a proper location in JSP, load the call. Jasper file, and print
Notes:
1. Set database connection
Set database connection parameters in datasource/connection
2. Create multi-page reports:
Create a group, add several groups to the group, add subreport tool to the group, and specify the path of the subreport in subreport.
3. electronic seal
Create a seal image, save it to the database, add the image tool on the main interface, and set the image expression class to Java. io. inputstream: select the transparent attribute for the image and set the image expression to the corresponding SQL field. Extract the image from the database in an SQL statement, and set the field class type of this field to Java. Io. inputstream.
(1) jasperreports is an open-source Java report production engine ireport. It is a GUI tool of jasperreports to generate jrxml files of jasperreports. (2) Java calls jasperreport: 2.1 to import jar package has: jasperreports-0.6.8.jarcommons-logging-1.0.2.jaritext-1.02b.jariTextAsian.jar output PDF Chinese garbled problem: 1. Make sure to add itextasian. jar, itext 1.3.1, jasperreport 1.2.8 to the application Program Or add to classpath, if the web application is placed in the corresponding WEB-INF \ Lib. 2 set Chinese support to set the relevant properties of the display object on the report is as follows: font name: (Chinese font) PDF Font Name: stsong-light PDF encoding: UniGB-UCS2-H (Chinese siplified) PDF embeded: √ you can also use the view-Report fonts-new font of ireport to achieve unified settings.
Output PDF Chinese garbled characters:
1. Make sure to add itextasian. jar, itext 1.3.1, jasperreport 1.2.8 to the build path of the application or to classpath if the web application is placed in the corresponding WEB-INF \ Lib. 2 set Chinese support to set the relevant properties of the display object on the report is as follows: font name: (Chinese font) PDF Font Name: stsong-light PDF encoding: UniGB-UCS2-H (Chinese siplified) PDF embeded: √ you can also use the view-Report fonts-new font of ireport to achieve unified settings.
For more information, see:
Jasperreport learning Manual
Jasperreport Development notes
Ireport + jasperreport Series
Sort out ireport + jasperreports Report 1