Jump to content
We've recently updated our Privacy Statement, available here ×

Generating Reports with instructured data


aissaoui.moetaz

Recommended Posts

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

@RequestMapping(value="/getSviClanoviReport.pdf", method=RequestMethod.GET)
    public void showReport(HttpServletResponse response) throws Exception{
        JRBeanCollectionDataSource dataSource = new JRBeanCollectionDataSource(cr.findAllByOrderByDatumUpisa());
        InputStream inputStream = this.getClass().getResourceAsStream("/jasperreports/SviClanoviReport.jrxml");
        JasperReport jasperReport = JasperCompileManager.compileReport(inputStream);
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("imeBiblioteke", "Biblioteka DMI");
        JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, params, dataSource);
        inputStream.close();
        
        
        response.setContentType("application/x-download");
        response.addHeader("Content-disposition", "attachment; filename=SviClanovi.pdf");
        OutputStream out = response.getOutputStream();
        JasperExportManager.exportReportToPdfStream(jasperPrint,out);
    }

 

Another One 

@RequestMapping(value="/ClanoviUPeriodu.pdf", method=RequestMethod.GET)
    public void showReport1(HttpServletResponse response, Date datumOd, Date datumDo) throws Exception{
        JRBeanCollectionDataSource dataSource = new JRBeanCollectionDataSource(cr.getClanoviUPeriodu(datumOd, datumDo));
        InputStream inputStream = this.getClass().getResourceAsStream("/jasperreports/ClanoviUPeriodu.jrxml");
        JasperReport jasperReport = JasperCompileManager.compileReport(inputStream);
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("datumOd", datumOd);
        params.put("datumDo", datumDo);
        JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, params, dataSource);
        inputStream.close();
        
        
        response.setContentType("application/x-download");
        response.addHeader("Content-disposition", "attachment; filename=ClanoviUPeriodu.pdf");
        OutputStream out = response.getOutputStream();
        JasperExportManager.exportReportToPdfStream(jasperPrint,out);
    }

 

Link to comment
Share on other sites

@RequestMapping(value="/getSviClanoviReport.pdf", method=RequestMethod.GET)
    public void showReport(HttpServletResponse response) throws Exception{
        JRBeanCollectionDataSource dataSource = new JRBeanCollectionDataSource(cr.findAllByOrderByDatumUpisa());
        InputStream inputStream = this.getClass().getResourceAsStream("/jasperreports/SviClanoviReport.jrxml");
        JasperReport jasperReport = JasperCompileManager.compileReport(inputStream);
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("imeBiblioteke", "Biblioteka DMI");
        JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, params, dataSource);
        inputStream.close();
        
        
        response.setContentType("application/x-download");
        response.addHeader("Content-disposition", "attachment; filename=SviClanovi.pdf");
        OutputStream out = response.getOutputStream();
        JasperExportManager.exportReportToPdfStream(jasperPrint,out);
    }

Another One 

@RequestMapping(value="/ClanoviUPeriodu.pdf", method=RequestMethod.GET)
    public void showReport1(HttpServletResponse response, Date datumOd, Date datumDo) throws Exception{
        JRBeanCollectionDataSource dataSource = new JRBeanCollectionDataSource(cr.getClanoviUPeriodu(datumOd, datumDo));
        InputStream inputStream = this.getClass().getResourceAsStream("/jasperreports/ClanoviUPeriodu.jrxml");
        JasperReport jasperReport = JasperCompileManager.compileReport(inputStream);
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("datumOd", datumOd);
        params.put("datumDo", datumDo);
        JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, params, dataSource);
        inputStream.close();
        
        
        response.setContentType("application/x-download");
        response.addHeader("Content-disposition", "attachment; filename=ClanoviUPeriodu.pdf");
        OutputStream out = response.getOutputStream();
        JasperExportManager.exportReportToPdfStream(jasperPrint,out);
    }

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...