You did not specify the datasource and so the cause of your report is empty.
You can set whenNoDataType
(When No Data
property in iReport) report's attribute for showing "empty" report.
The possible values of this attribute are:
- No Pages: The generated document will have no pages in
it. Viewers might throw an error when trying to load such documents
(
whenNoDataType="NoPages"
).
- Blank Page: The generated document will contain a single blank page
(
whenNoDataType="BlankPage"
).
- All Sections, No Detail: All the report sections except the Detail section (band) will appear in the generated document (
whenNoDataType="AllSectionsNoDetail"
).
- No Data Section: The generated document will contain only a single noData section (band)
(
whenNoDataType="NoDataSection"
).
In case using noData section you should add this band to the report's template (for example, with help of iReport).
When you are using the Java code like this:
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport,
map, new JREmptyDataSource());
it means that you are passing the empty datasource or in other words did not pass the datasource.
In case you did not pass datasource and database connection the only chance to show the data at report - is to pass data via parameters (or initialize parameters inside the report's template)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…