Java side:
@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 page End:
<div style= "padding:10px 30px 10px 30px" >
<form id= "Creditinfoform" method= "post" action= "Reportout" >
<table>
<tr>
<td> Report Name:</td>
<td>
<input name= "FileName" value= "Test" >
</td>
</tr>
<tr>
<td> Report path name:</td>
<td>
<input name= "Jasperpath" value= "statementreport.jasper" >
</td>
</tr>
<tr>
<td> Export Type:</td>
<td>
<select name= "DocType" >
<option>HTML</option><option>XLS</option>
</select> yuan
</td>
</tr>
<tr>
<td> parameter:</td>
<td>
<input name= "Search_name" value= "Caoz" >
</td>
</tr>
</table>
<input type= "Submit" >
</form>
</div>
ireport development reports, how Java and JSP end integrate