Im creating a jasperreport field from a springboot + react application and i want to create a pdf with some static text and some text passed from database. Im doing a test using static text on my backend like this:
Map<String, Object> params = new HashMap<String, Object>();
params.put("riesgos", "TEXTO DE RIESGOS");
JasperPrint report = JasperFillManager.fillReport(JasperCompileManager.compileReport(ResourceUtils.getFile("classpath:risks.jrxml").getAbsolutePath()), params, new JREmptyDataSource());
And this is my jasper file:
<title>
<band height="50">
<staticText>
<reportElement x="0" y="0" width="555" height="20"/>
<text><![CDATA[Texto de prueba estático - Lorem Ipsum]]></text>
</staticText>
</band>
</title>
<detail>
<band height="50">
<textField>
<reportElement x="0" y="0" width="555" height="20"/>
<textElement>
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{riesgos}]]></textFieldExpression>
</textField>
</band>
</detail>
<summary>
<band height="50">
<staticText>
<reportElement x="0" y="0" width="555" height="20"/>
<text><![CDATA[Texto de prueba estático - Otro párrafo]]></text>
</staticText>
</band>
</summary>
But the file is showing like this:
Texto de prueba estático - Lorem Ipsum
null
Texto de prueba estático - Otro párrafo