`
zjnbshifox
  • 浏览: 312110 次
  • 性别: Icon_minigender_1
  • 来自: 宁波
社区版块
存档分类
最新评论

jasper report与Spring mvc整合

    博客分类:
  • Java
阅读更多
配置jasper view resolver
<bean id="pdfReport"
	   class="org.springframework.web.servlet.view.jasperreports.JasperReportsPdfView"
		p:url="/WEB-INF/reports/TaxTicket.jrxml"
		p:reportDataKey="datasource" />

参数传递
//datasource要和p:reportDataKey对应
parameterMap.put("datasource", new JREmptyDataSource());
//pdf report要和beanid对应
return new ModelAndView("pdfReport", parameterMap);

JREmptyDataSource是空数据源,如果要传入List,则使用
List<Product> beanCollection = new ArrayList<Product>();  
JRDataSource dataSource = new JRBeanCollectionDataSource(beanCollection);  

在jrxml中,使用
<textFieldExpression><![CDATA[$F{name}]]></textFieldExpression> 

name为Product的属性
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics