Problem generating report JasperReport in JavaFx

0

When I try to generate a report it turns out that the "The document does not have pages", this is the code with which I generate it.

public class Reporte {    

 public void generarReporte() throws JRException{

    try{

      HashMap parametro = new HashMap();
      parametro.put("","");

      JasperReport reporte = JasperCompileManager.compileReport("report1.jrxml");    

      JasperPrint jasperPrint  = JasperFillManager.fillReport(reporte,parametro);
      JasperViewer view =  new JasperViewer(jasperPrint,false);
      view.setVisible(true);
    } catch(Exception ex){
        System.out.println("Error: "+ex);
    }

 }

}
    
asked by Jeisson Hernandez 06.12.2017 в 00:36
source

1 answer

0

That message comes out when the report has no results to show, that is, there is no data as requested. In your code I can notice that you do not specify the data source that will be used to load the data in the JasperPrint. For example if the data comes from a database you must place the Connection object, like this:

JasperPrint jasperPrint  = JasperFillManager.fillReport(reporte,parametro,con);

Assuming that con is the name of the Connection object that you will use. I hope I have helped you.

    
answered by 06.12.2017 / 05:43
source