i got this problem when i try to export a datatable information to PDF, the method do all, but it doesn't download the PDF or even generate.
Netbeans version: 8.2
JSF: 2.2
Primefaces: 5.3
Libraries used:
Jasperreports 6.3
poi 3.14
commons-beanutils-1.9.0
commons-collection-3.2.2
commons-digester-2.1
commons-logging-1.1.1
groovy-all-2.4.0
itext-2.1.7.js5
jaxp-ri
jcommon-1.0.23
jfreechart-1.0.19
And my method is:
public void exportpdf(OrdenRetiro or) throws JRException, IOException {
conexion con = new conexion();
Map<String, Object> parametros = new HashMap<String, Object>();
FacesContext context = FacesContext.getCurrentInstance();
ServletContext servleContext = (ServletContext) context.getExternalContext().getContext();
parametros.put("RutaImagen", servleContext.getRealPath("/reportes/"));
parametros.put("cod_ordenretiro", or.getCod_ordenretiro());
String temperatura = or.getEs_temperado()==1?"ReporteFreezer.jasper":"ReporteNoFreezer.jasper";
String dirReporte = servleContext.getRealPath("/reportes/"+temperatura);
HttpServletResponse response = (HttpServletResponse) context.getExternalContext().getResponse();
response.addHeader("Content-disposition", "attachment;filename=Orden de Retiro"+or.getCod_ordenretiro()+".pdf");
response.setContentType("application/pdf");
JasperPrint impres = JasperFillManager.fillReport(dirReporte, parametros, con.getConnection());
JasperExportManager.exportReportToPdfStream(impres, response.getOutputStream());
context.responseComplete();
}
Any idea?