在我的一个用于报告的bean类中,有一个来自类型Hashtable<String, String>
的属性。关键是老师,价值是教室。
我创建了一个字段:
<field name="assignedClassrooms" class="java.util.Hashtable"/>
但是现在我对如何从报表中的哈希表中获取键和值有些迷惑。我很乐意作为带有详细说明栏的专栏来做。这是我的代码:
<columnHeader>
<band height="24">
<textField>
<reportElement x="0" y="0" width="160" height="15"/>
<textFieldExpression><![CDATA[$R{Teacher}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="160" y="0" width="110" height="15"/>
<textFieldExpression><![CDATA[$R{Classroom}]]></textFieldExpression>
</textField>
</band>
</columnHeader>
<detail>
<band height="24">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="0" y="2" width="150" height="15"/>
<textFieldExpression><![CDATA[$F{assignedClassrooms}XXXXXXXX]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="160" y="2" width="150" height="15"/>
<textFieldExpression><![CDATA[$F{assignedClassrooms}XXXXXXXXX]]></textFieldExpression>
</textField>
</band>
</detail>