Bonjour,
Je veux afficher un rapport généré par ireport dans une application web utilisant spring et jsf.
J'ai utilisé une méthode dans mon bean pour effectuer ceci, dont voici le 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 25 26 27 28 29 30 31 32 33 34 35
| public void print () {
try {
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("ReportTitle", " My Title");
List<monDto> listes = this.getList();
JasperFillManager.fillReportToFile("C:/Reports/myreport.jasper",
parameters, new JRBeanCollectionDataSource(listes));
JasperExportManager.exportReportToPdfFile("C:/Reports/myreport.jrprint");
}
catch (JRException e)
{
e.printStackTrace();
}
catch (Exception e)
{
e.printStackTrace();
}
}
private String printReport()
{
try {
this.print();
} catch (Exception e) {
log.info("Report error ==>"+ e.getMessage());
}
return null;
} |
J'ai appelé par la suite dans ma jsf la méthode dans un bouton
<h:commandButton value="Click" action="#{monBean.printReport}" />
mais rien ne se passe lorsque je clique sur le bouton.
Merci de m'aider à résoudre ce problème
Partager