ireport开发报表,Java和JSP端如何集成?
Java端:
@RequestMapping("/report")
public String report() {
return "/credit/report/report";
}
@RequestMapping("/reportOut")
@ResponseBody
public void reportOut(@RequestParam(value = "fileName") String fileName,@RequestParam(value = "jasperPath") String jasperPath,@RequestParam(value = "docType") String docType,HttpServletRequest request,HttpServletResponse response) throws JRException, IOException, ServletException, SQLException {
SimpleDateFormat sd = new SimpleDateFormat("yyyyMMddhhmmss");
Map<String, Object> searchmap = getParametersStartingWith(request, "search_");
jasperPath = report_url + jasperPath;
ReportUtils reportUtils = new ReportUtils(request, response);
reportUtils.servletExportDocument(ReportUtils.DocType.valueOf(docType), jasperPath, searchmap,jdbcTemplate.getDataSource().getConnection(),fileName+sd.format(new Date()));
}
JSP页面端:
<div >
<form >
</form>
</div>