在 Jasper 报告中,我们收到错误 1。字符串文字未正确用双引号关闭

问题描述 投票:0回答:1

生成报告时我们得到

SEVERE: Servlet.service() for servlet [dispatcher] in context with path [/myapp] threw exception [Request processing failed; nested exception is com.openpayment.api.service.ApplicationException: net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:
1. String literal is not properly closed by a double-quote
                value = ((net.sf.jasperreports.engine.JasperReport)parameter_subreportA5.getValue())"; //$JR_EXPR_ID=15$
                                                                                                    <------------------>

JRXML 是:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.21.2.final using JasperReports Library version 6.21.2-8434a0bd7c3bbc37cbf916f2968d35e4b165821a  -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="MobileA4Main" pageWidth="595" pageHeight="842" columnWidth="595" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="fd3c50b8-f0bb-4689-b77c-a028f0955fe4">
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
    <parameter name="name" class="java.lang.String">
        <defaultValueExpression><![CDATA["NAME"]]></defaultValueExpression>
    </parameter>
    <parameter name="account" class="java.lang.String">
        <defaultValueExpression><![CDATA["11111"]]></defaultValueExpression>
    </parameter>
    <parameter name="url" class="java.lang.String">
        <defaultValueExpression><![CDATA["https://google.com"]]></defaultValueExpression>
    </parameter>
    <parameter name="subreportA5" class="net.sf.jasperreports.engine.JasperReport">
<!--        <defaultValueExpression><![CDATA["https://google.com"]]></defaultValueExpression>-->
    </parameter>
    <queryString>
        <![CDATA[]]>
    </queryString>
    <background>
        <band splitType="Stretch"/>
    </background>
    <title>
        <band height="665" splitType="Stretch">
            <subreport>
                <reportElement x="0" y="0" width="420" height="595" uuid="b96f6247-8f25-40be-b361-d70f8dd8db5a">
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <subreportParameter name="name">
                    <subreportParameterExpression><![CDATA[$P{name}]]></subreportParameterExpression>
                </subreportParameter>
                <subreportParameter name="url">
                    <subreportParameterExpression><![CDATA[$P{url}]]></subreportParameterExpression>
                </subreportParameter>
                <subreportParameter name="account">
                    <subreportParameterExpression><![CDATA[$P{account}]]></subreportParameterExpression>
                </subreportParameter>
                <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.JREmptyDataSource()]]></dataSourceExpression>
                <subreportExpression><![CDATA[$P{subreportA5}"]]></subreportExpression>
            </subreport>
            <frame>
                <reportElement x="0" y="0" width="420" height="595" uuid="fe3ca5d8-c38f-4db1-b753-b55ffb832061"/>
                <box>
                    <pen lineWidth="0.5" lineStyle="Dashed"/>
                    <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <bottomPen lineWidth="0.5" lineStyle="Dashed" lineColor="#000000"/>
                    <rightPen lineWidth="0.5" lineStyle="Dashed" lineColor="#000000"/>
                </box>
            </frame>
        </band>
    </title>
</jasperReport>
java jasper-reports
1个回答
0
投票

原因是“在

<subreportExpression><![CDATA[$P{subreportA5}"]]></subreportExpression>

删除后,错误消失了。

© www.soinside.com 2019 - 2024. All rights reserved.