Slt,
J'ai utilise spring boot 2.O pour réaliser mon application.
et j'ai utilise la dépendance pour jasperrepor
Voila mon code de reportingCode:
1
2
3
4
5
6
7 <dependency> <groupId>net.sf.jasperreports</groupId> <artifactId>jasperreports</artifactId> <version>6.5.1</version> <type>jar</type> </dependency>
après l’exécution j'ai eu cette résulta:Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 @RequestMapping(value="/report1",method=RequestMethod.GET) @ResponseBody public void report1(HttpServletResponse response) { InputStream jasperStream=this.getClass().getResourceAsStream("/reports/report1.jrxml"); JasperDesign design=JRXmlLoader.load(jasperStream); JasperReport report=JasperCompileManager.compileReport(design); Map<String, Object> params=new HashMap<String, Object>(); List<Incident> incidents=incidentRepository.findAll(); JRDataSource jRDataSource=new JRBeanCollectionDataSource(incidents); params.put("dataSource", jRDataSource); JasperPrint jasperPrint=JasperFillManager.fillReport(report,params,jRDataSource); response.setHeader("Content-Disposition", "inline ; filename=insidents.pdf"); final OutputStream outputStream=response.getOutputStream(); JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream); }catch(JRException ex){ log.info("erreur de reporting"); } catch(IOException e){ log.info("********"); } }
Pièce jointe 386643
quelqu'un m'aide
merci.