Problem with iReport and JSF
I'd like to show a report generated by iReport, in a JSF page. I use this method in my bean,
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.ja开发者_运维百科sper",
parameters,
new JRBeanCollectionDataSource(listes));
JasperExportManager.exportReportToPdfFile("C:/Reports/myreport.jrprint");
}
catch (JRException e)
{
e.printStackTrace();
}
catch (Exception e)
{
e.printStackTrace();
}
}
Then in my XHTML page I declare a button using the print() method,
<h:commandButton value="Click" action="#{myBean.print}" />
But when I clicked on the button, the method was not running.
精彩评论