【发布时间】:2015-12-24 12:58:09
【问题描述】:
我无法将 spring mvc 实体方法调用到 jasper 报告中。这是我想在 jasper 报告中调用的方法。
public BigDecimal getOutstanding(){
BigDecimal currentBalance = this.getCurrentBalance() != null ? this.getCurrentBalance() : new BigDecimal(0);
BigDecimal payableAmount = this.getPayableAmount() != null ? this.getPayableAmount() : new BigDecimal(0);
return payableAmount.subtract(currentBalance);
}
我尝试了以下方法:
<field name="customer" class="com.rightbrainsolution.titas.domesticbilling.entities.Customer"/>
<textField>
<reportElement x="810" y="-15" width="210" height="14" uuid="91aaf617-bd64-4406-a74e-9c9eee52db56"/>
<textFieldExpression><![CDATA[$F{customer}.getOutstanding()]]></textFieldExpression>
</textField>
但不工作说:
[错误] 无法编译优秀的.jrxml net.sf.jasperreports.engine.design.JRValidationException:报告设计无效: 1. java.lang.ClassNotFoundException: com.rightbrainsolution.titas.domesticbilling.entities.Customer
【问题讨论】:
-
错误告诉您:当您尝试生成报告时,您的
Customer类不在 jasper 的类路径中。调用属性访问器不是问题(你没有那么远)。 -
将客户添加到您的 jasper 报告的类路径