Hi,
I am getting stuck while downloading the PDF , XLS file.
Actually I am able to download the files but I think facesCtx.responseComplete(); is not working properly.
If I click to download PDF it downloads properly. After that If I click to download XLS file it is again calling PDF Download process and then XLS.
Means my request object is not completed, it is still forwared to new process.
I am using JSF-SEAM-EJB3.0
And JBoss 4.2.1 GA.
Below is my code.
if (type.equals("pdf")) {
response.setContentType("application/pdf");
design.setIgnorePagination(false);
exporter = new JRPdfExporter();
exporter.setParameter(JRExporterParameter.JASPER_PRINT,
print);
exporter.setParameter(JRExporterParameter.OUTPUT_STREAM,
response.getOutputStream());
}else {
response.setContentType("application/vnd.ms-excel");
design.setIgnorePagination(true);
byte[] bytes = null;
ServletOutputStream ouputStream = response.getOutputStream();
ByteArrayOutputStream xlsReport = new ByteArrayOutputStream();
JExcelApiExporter jExcelApiExporter = new JExcelApiExporter();
jExcelApiExporter.setParameter(JRExporterParameter.JASPER_PRINT, print);
jExcelApiExporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, showType);
jExcelApiExporter.setParameter(JRExporterParameter.OUTPUT_STREAM, ouputStream);
jExcelApiExporter.exportReport();
}
exporter.exportReport();
// Tell JavaServer Faces that no output is required
facesCtx.responseComplete();
I have the same problem too. Idea how to get it work?