我正在用Java生成一个jasper报告。 它有一个Student bean,其中包含college_name和student_info(第二个bean)列表。 Student_info包含student_Name和地址 我已将college_Name和Student_info bean的列表设置为Student bean。
当我只将student_info(第二个bean)对象(不是List)设置为Student bean时,我得到了值,但是当我传递Student_info bean列表时,得到一个错误无效表达式。 我不知道如何获取Student_info列表,然后它的值如student_Name和address。
它给了我以下错误:
net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression :
aa DEBUG net.sf.jasperreports.engine.util.DeduplicableRegistry: Found existing instance net.sf.jasperreports.engine.fill.JRTemplateText@526b3f for object net.sf.jasperreports.engine.fill.JRTemplateText@2b5c2d
Source text : $F{Student_infoDTOList}.getName()
at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:244)
at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:591)
aa DEBUG net.sf.jasperreports.engine.util.DeduplicableRegistry: Added object net.sf.jasperreports.engine.fill.JRTemplateText@b0c9f0
at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:559)
at net.sf.jasperreports.engine.fill.JRFillElement.evaluateExpression(JRFillElement.java:1016)
at net.sf.jasperreports.engine.fill.JRFillTextField.evaluateText(JRFillTextField.java:504)
at net.sf.jasperreports.engine.fill.JRFillTextField.evaluate(JRFillTextField.java:488)
aa DEBUG net.sf.jasperreports.engine.fill.JRFillTextField: created net.sf.jasperreports.engine.fill.JRTemplateText@b0c9f0 for (null, null)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:259)
at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:456)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2057)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:778)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:288)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:151)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:932)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:864)
at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:114)
at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:653)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:969)
我的JRXml文件是:
<textField isBlankWhenNull="false">
<reportElement key="textField" x="42" y="0" width="112" height="13" uuid="1e3a7dff-583c-4322-88cb-c2c0f1ea7569"/>
<textElement>
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{Student_infoDTOList}.getName()]]></textFieldExpression>
</textField>
答案 0 :(得分:0)
您应该执行此步骤。