当我在报表上使用Json元数据并将其导出到Json时,其表达式的计算结果为的文本字段null
,而不是打印this:,{... "field"=null ...}
是在打印此:{... "field"="null" ...}
。
JasperReportsnull
作为String处理"null"
。如果我将字段设置为“ null时为空白”,则会打印:{... "field"="" ...}
。
有办法避免这种情况吗?
通过将文本字段表达式复制为net.sf.jasperreports.export.json.data属性的表达式,可以在JSON输出中具有空值。如
<textField>
<reportElement ...>
<property name="net.sf.jasperreports.export.json.path" value="FieldThatCanBeNull"/>
<propertyExpression name="net.sf.jasperreports.export.json.data"><![CDATA[$F{FieldThatCanBeNull}]]></propertyExpression>
</reportElement>
<textFieldExpression><![CDATA[$F{FieldThatCanBeNull}]]></textFieldExpression>
</textField>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句