没有为名为’success’的’dynamic-jasper’类型定义结果类型

我正在尝试使用带有Struts 2.3.4的DynamicJasper 5.0.0。 我使用以下代码以PDF格式显示数据

在动作课上

try { FastReportBuilder drb = new FastReportBuilder(); DynamicReport dr = drb.addColumn("Size", "size", String.class.getName(), 30).setTitle("Size List Report").setSubtitle("This report was generateed at" + new Date()).setUseFullPageWidth(true) //make colums to fill the page width .setPrintBackgroundOnOddRows(true).build(); JRDataSource ds = new JRBeanCollectionDataSource(getSizeList()); JasperPrint jp = DynamicJasperHelper.generateJasperPrint(dr, new ClassicLayoutManager(), ds); JasperViewer.viewReport(jp); //finally display the report report [/CODE] } catch (Exception e) { System.out.println("Exception"); } return SUCCESS; 

在struts.xml

       dr sizeList Dynamic Report generated with struts 2 params PDF classic    

运行此时,我收到以下错误

 There is no result type defined for type 'dynamic-jasper' mapped with name 'success'. Did you mean 'dynamicJasper'? - result - file:/E:/Project/cxn/cnx/build/web/WEB-INF/classes/struts.xml:571:58 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.buildResults(XmlConfigurationProvider.java:653) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:387) ... 20 more 

我已经包含以下jar文件 在此处输入图像描述

将此配置添加到您的包中

      dr sizeList Dynamic Report generated with struts 2 params PDF classic   

ActionSupport类位于包名com.opensymphony.xwork2 。 从Struts2使用的插件配置中发生错误,这与您使用的Struts版本不兼容。