zoukankan      html  css  js  c++  java
  • 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 style="padding: 10px 30px 10px 30px">
    <form id="creditInfoForm" method="post" action="reportOut">
    <table>
    <tr>
    <td>报表名称 :</td>
    <td>
    <input name="fileName" value="测试">
    </td>
    </tr>
    <tr>
    <td>报表路径名称 :</td>
    <td>
    <input name="jasperPath" value="statementReport.jasper">
    </td>
    </tr>
    <tr>
    <td>导出类型 :</td>
    <td>
    <select name="docType" >
    <option>HTML</option><option>XLS</option>
    </select>元
    </td>
    </tr>
    <tr>
    <td>参数 :</td>
    <td>
    <input name="search_name" value="CaoZ">
    </td>
    </tr>
    </table>
    <input type="submit">
    </form>
    </div>

  • 相关阅读:
    锁定键盘、鼠标 武胜
    Begin a forensics investigation with WinHex 武胜
    vc++ 访问php webService
    VC xml解析笔记
    关于php Soap一些错误。
    ZendStudio php WebService制作一:简单WebService Demo
    vc各种字符转换
    vc2008 访问C# WebService
    ZendStudio WSDL编辑器
    Nusoap复杂对象的的webService制作
  • 原文地址:https://www.cnblogs.com/wyh3721/p/4195809.html
Copyright © 2011-2022 走看看