Advertisement
Guest User

Untitled

a guest
Jan 24th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. Class.forName("org.postgresql.Driver");
  2. Connection conexion = DriverManager.getConnection("jdbc:postgresql://localhost:5432/reportes", usuario, contraseña;
  3. File reportDir=new File(getServletContext().getRealPath("WEB-INF/repProd.jasper"));
  4. JasperReport reporte= (JasperReport) JRLoader.loadObject(reportDir);
  5. JasperPrint jasperPrint = JasperFillManager.fillReport(reporte, null, conexion);
  6. JRExporter exporter = new JRPdfExporter();
  7. exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
  8. exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, out);//new java.io.File("reportePDF.pdf")
  9. exporter.exportReport();
  10.  
  11. JasperReport reporte= (JasperReport) JRLoader.loadObject(reportDir);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement