我想在iReport页面中显示由JSF生成的报告。 我在我的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.jasper",
parameters,
new JRBeanCollectionDataSource(listes));
JasperExportManager.exportReportToPdfFile("C:/Reports/myreport.jrprint");
}
catch (JRException e)
{
e.printStackTrace();
}
catch (Exception e)
{
e.printStackTrace();
}
}
然后在我的XHTML页面中,我使用print()方法声明了一个按钮,
<h:commandButton value="Click" action="#{myBean.print}" />
但是当我点击按钮时,方法没有运行。