My situation is when I\'m not able to retrieve anything with my query, that is found inside the jasper file, a report is still generated.
I\'m using this line of code t
Set on jasperReport
tag whenNoDataType="NoPages"
or remove whenNoDataType
attribute (default is "NoPages")
Check how many pages there are in the JasperPrint
, if 0 you have NoData
JasperPrint print = JasperFillManager.fillReport(jasperReportStream, params, jdbcConnection);
List<JRPrintPage> pages = print.getPages();
if (pages.size()==0){
//No pages, do not export instead do other stuff
}