我对这个问题的解决方案很简单。当你使用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-春季子报告 –