ireport development reports, how Java and JSP end integrate

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.