[jboss-user] [JBoss Seam] - Downloading the PDF , XLS file.

m.shinde do-not-reply at jboss.com
Wed Aug 29 08:25:32 EDT 2007


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();
  | 

Please suggest Where I am doing wrong. OR Do I need to follow other process.


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4079116#4079116

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4079116



More information about the jboss-user mailing list