我對這個問題的解決方案很簡單。當你使用ExtJs時,我認爲你的控制器是用JavaScript編寫的。
- 做Java服務器的請求,以創建您的PDF,XLS報告,無論
- 保存在會議的報告一鍵(可以在mileseconds的時間)
- 返回的關鍵,視圖並打開一個新的窗口,向服務器請求您的報告
新的Windows應該包含這樣http://localhost:8080/myApplication/report?key=312312313
一個URL如果你想下載到XSL你CA ñ試試這個:
private void exportToExcel(HttpServletResponse resp, JasperPrint jasperPrint) throws IOException {
String reportfilename = tagreport("file") + "repor.xls";
JExcelApiExporter exporterXLS = new JExcelApiExporter();
exporterXLS.setParameter(JRXlsExporterParameter.JASPER_PRINT,jasperPrint);
exporterXLS.setParameter(JRXlsExporterParameter.IS_DETECT_CELL_TYPE,Boolean.TRUE);
exporterXLS.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE);
exporterXLS.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE);
exporterXLS.setParameter(JRXlsExporterParameter.OUTPUT_STREAM, resp.getOutputStream());
resp.setHeader("Content-Disposition", "inline;filename="+ reportfilename);
resp.setContentType("application/vnd.ms-excel");
try {
exporterXLS.exportReport();
} catch (JRException e) {
e.printStackTrace();
}
}
可能重複:http://stackoverflow.com/questions/6365045/spring-mvc-3-0-jasper-reports-4-directing-html-reports-in-browser和HTTP ://stackoverflow.com/questions/7567660/inetgrating-ireportwith-large-no-of-sub-reports-with-spring-mvc&http://stackoverflow.com/questions/8239838/whats-the-best-way -to-show-html-reports-generated-by-jasperreport-in-a-jsp –
另一個鏈接:http://stackoverflow.com/questions/4446666/how-to-set-up-jasper-reports-in-春季子報告 –