0

嗨,我在 jasper 报告中添加了两个数组列表,其中填充了来自两个列表的值。我可以打印这些值,但是基于另一个列表,其他值正在获取空值。如果框架内的元素为空,我想禁用框架。在此处输入图像描述

如何避免 jasper 报告中两个不同列表的空值。

.jrxml 文件

<?xml version="1.0" encoding="UTF-8"?>
<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="jasper_report_template" pageWidth="595" pageHeight="842" columnWidth="565" leftMargin="15" rightMargin="15" topMargin="50" bottomMargin="50" uuid="780c6d10-1bc3-4d3b-9925-fed934f5e378">
    <property name="ireport.zoom" value="1.5000000000000027"/>
    <property name="ireport.x" value="0"/>
    <property name="ireport.y" value="0"/>
    <parameter name="ReportName" class="java.lang.String"/>
    <parameter name="Date" class="java.lang.String"/>
    <parameter name="Title" class="java.lang.String"/>
    <parameter name="SubTitle" class="java.lang.String"/>
    <parameter name="FooterDetail" class="java.lang.String"/>
    <parameter name="govtlogo" class="java.lang.String"/>
    <parameter name="TNWRDLogo" class="java.lang.String"/>
    <field name="training" class="java.lang.String"/>
    <field name="trainingPeriod" class="java.lang.String"/>
    <field name="traingingAdd" class="java.lang.String"/>
    <field name="noofgovtorderauth" class="java.lang.String"/>
    <field name="authapprovingentry" class="java.lang.String"/>
    <field name="deptTestpassed" class="java.lang.String"/>
    <field name="athConducTest" class="java.lang.String"/>
    <field name="monthSptestPassed" class="java.lang.String"/>
    <field name="yrSpTestPassed" class="java.lang.String"/>
    <field name="regNo" class="java.lang.String"/>
    <pageHeader>
        <band height="113" splitType="Stretch">
            <textField>
                <reportElement uuid="4b625cd6-92c8-4fda-b3c9-0b406cbe3f6b" x="174" y="56" width="213" height="24"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="9" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$P{ReportName}]]></textFieldExpression>
            </textField>
            <frame>
                <reportElement uuid="dbca43bb-2948-4671-a6ff-c6450236d529" x="0" y="0" width="565" height="52">
                    <property name="net.sf.jasperreports.export.pdf.tag.h1"/>
                    <property name="net.sf.jasperreports.export.pdf.tag.tr" value="full"/>
                    <property name="net.sf.jasperreports.export.pdf.tag.th" value="full"/>
                    <property name="net.sf.jasperreports.export.pdf.tag.td" value="full"/>
                </reportElement>
                <box>
                    <pen lineWidth="0.25"/>
                    <topPen lineWidth="0.25"/>
                    <leftPen lineWidth="0.25"/>
                    <bottomPen lineWidth="0.25"/>
                    <rightPen lineWidth="0.25"/>
                </box>
                <textField>
                    <reportElement uuid="d90ef865-ebfb-46b1-a340-4e55f2f2e105" x="174" y="33" width="213" height="19"/>
                    <textElement textAlignment="Center" verticalAlignment="Middle">
                        <font size="8" isBold="true"/>
                    </textElement>
                    <textFieldExpression><![CDATA[$P{SubTitle}]]></textFieldExpression>
                </textField>
                <image>
                    <reportElement uuid="7cb82eb8-ddc2-4594-ba88-83e33242cb74" x="442" y="2" width="61" height="48"/>
                    <imageExpression><![CDATA[$P{TNWRDLogo}]]></imageExpression>
                </image>
                <image>
                    <reportElement uuid="12e4f0bf-39a9-46be-a5ef-bcfbf1262b55" x="65" y="0" width="98" height="51"/>
                    <imageExpression><![CDATA[$P{govtlogo}]]></imageExpression>
                </image>
                <textField>
                    <reportElement uuid="fd58086e-9ebc-403e-9b9f-d7152c729b17" x="174" y="0" width="213" height="32"/>
                    <textElement textAlignment="Center" verticalAlignment="Middle">
                        <font size="14" isBold="true"/>
                    </textElement>
                    <textFieldExpression><![CDATA[$P{Title}]]></textFieldExpression>
                </textField>
            </frame>
            <frame>
                <reportElement uuid="5e897182-f014-4818-8722-553458e93a9c" x="0" y="52" width="565" height="39"/>
                <box>
                    <pen lineWidth="0.25"/>
                    <topPen lineWidth="0.25"/>
                    <leftPen lineWidth="0.25"/>
                    <bottomPen lineWidth="0.25"/>
                    <rightPen lineWidth="0.25"/>
                </box>
            </frame>
            <staticText>
                <reportElement uuid="e7796275-9ed5-4d20-832a-ddbf97a01fb5" x="95" y="91" width="100" height="22"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font isBold="true"/>
                </textElement>
                <text><![CDATA[Training Detail]]></text>
            </staticText>
            <staticText>
                <reportElement uuid="69ec207d-faf3-4a66-8674-cbd67dac6b6e" x="370" y="91" width="100" height="22"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font isBold="true"/>
                </textElement>
                <text><![CDATA[Special Tests Passed]]></text>
            </staticText>
        </band>
    </pageHeader>
    <columnHeader>
        <band height="22" splitType="Stretch">
            <staticText>
                <reportElement uuid="e22a7b62-6241-4669-829d-021ee5ac1925" mode="Opaque" x="0" y="0" width="276" height="22" backcolor="#70A9A9"/>
                <box>
                    <bottomPen lineWidth="1.0" lineColor="#CCCCCC"/>
                </box>
                <textElement>
                    <font size="7"/>
                </textElement>
                <text><![CDATA[]]></text>
            </staticText>
            <frame>
                <reportElement uuid="f3ae6dec-51ea-4025-8579-1d28ba6f4407" x="0" y="0" width="56" height="22"/>
                <box>
                    <pen lineWidth="0.25"/>
                    <topPen lineWidth="0.25"/>
                    <leftPen lineWidth="0.25"/>
                    <bottomPen lineWidth="0.25"/>
                    <rightPen lineWidth="0.25"/>
                </box>
                <staticText>
                    <reportElement uuid="5159b066-4683-44f1-9b65-e055f2b1cafe" x="0" y="0" width="56" height="22"/>
                    <textElement textAlignment="Center" verticalAlignment="Middle">
                        <font size="6" isBold="true"/>
                    </textElement>
                    <text><![CDATA[Training]]></text>
                </staticText>
            </frame>
            <frame>
                <reportElement uuid="ffd3fdbf-8738-4ebe-a561-99a97f130e4b" x="56" y="0" width="56" height="22"/>
                <box>
                    <pen lineWidth="0.25"/>
                    <topPen lineWidth="0.25"/>
                    <leftPen lineWidth="0.25"/>
                    <bottomPen lineWidth="0.25"/>
                    <rightPen lineWidth="0.25"/>
                </box>
                <staticText>
                    <reportElement uuid="cc3adf76-6ac7-48be-bbb7-8e62039621af" positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="56" height="22"/>
                    <textElement textAlignment="Center" verticalAlignment="Middle">
                        <font size="6" isBold="true"/>
                    </textElement>
                    <text><![CDATA[Period / Duration]]></text>
                </staticText>
            </frame>
            <frame>
                <reportElement uuid="946ec200-73a7-488a-bc35-dc9f6320d0a1" x="112" y="0" width="56" height="22"/>
                <box>
                    <pen lineWidth="0.25"/>
                    <topPen lineWidth="0.25"/>
                    <leftPen lineWidth="0.25"/>
                    <bottomPen lineWidth="0.25"/>
                    <rightPen lineWidth="0.25"/>
                </box>
                <staticText>
                    <reportElement uuid="efdd44ba-7628-4de4-81f8-1c1d6f62fdfc" positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="56" height="22"/>
                    <textElement textAlignment="Center" verticalAlignment="Middle">
                        <font size="6" isBold="true"/>
                    </textElement>
                    <text><![CDATA[Impart Training Address]]></text>
                </staticText>
            </frame>
            <frame>
                <reportElement uuid="3ed3853f-0db7-4a74-8563-73562f8937c1" x="168" y="0" width="56" height="22"/>
                <box>
                    <pen lineWidth="0.25"/>
                    <topPen lineWidth="0.25"/>
                    <leftPen lineWidth="0.25"/>
                    <bottomPen lineWidth="0.25"/>
                    <rightPen lineWidth="0.25"/>
                </box>
                <staticText>
                    <reportElement uuid="b6f661f7-4f1a-4db9-b676-2423af068120" positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="56" height="22"/>
                    <textElement textAlignment="Center" verticalAlignment="Middle">
                        <font size="6" isBold="true"/>
                    </textElement>
                    <text><![CDATA[No of Government Orders]]></text>
                </staticText>
            </frame>
            <frame>
                <reportElement uuid="139ae6bc-b508-4694-a6bd-9eeadd230701" x="224" y="0" width="52" height="22"/>
                <box>
                    <pen lineWidth="0.25"/>
                    <topPen lineWidth="0.25"/>
                    <leftPen lineWidth="0.25"/>
                    <bottomPen lineWidth="0.25"/>
                    <rightPen lineWidth="0.25"/>
                </box>
                <staticText>
                    <reportElement uuid="83907da0-14a1-4da5-9645-a72e3ff31a49" x="0" y="0" width="52" height="22"/>
                    <textElement textAlignment="Center" verticalAlignment="Middle">
                        <font size="6" isBold="true"/>
                    </textElement>
                    <text><![CDATA[ Approving Audthority]]></text>
                </staticText>
            </frame>
            <staticText>
                <reportElement uuid="36afb6e9-a471-406e-bdad-aeafef6b41ee" mode="Opaque" x="286" y="0" width="279" height="22" backcolor="#70A9A9"/>
                <box>
                    <bottomPen lineWidth="1.0" lineColor="#CCCCCC"/>
                </box>
                <textElement>
                    <font size="7"/>
                </textElement>
                <text><![CDATA[]]></text>
            </staticText>
            <frame>
                <reportElement uuid="c5c26ed0-9561-4da2-b5d6-9ca72ef55e0b" x="496" y="0" width="69" height="22"/>
                <box>
                    <pen lineWidth="0.25"/>
                    <topPen lineWidth="0.25"/>
                    <leftPen lineWidth="0.25"/>
                    <bottomPen lineWidth="0.25"/>
                    <rightPen lineWidth="0.25"/>
                </box>
                <staticText>
                    <reportElement uuid="c09a3ce2-8965-475b-b436-6dce64259171" x="0" y="0" width="69" height="22"/>
                    <textElement textAlignment="Center" verticalAlignment="Middle">
                        <font size="8" isBold="true"/>
                    </textElement>
                    <text><![CDATA[Year of Passing ]]></text>
                </staticText>
            </frame>
            <frame>
                <reportElement uuid="cf68099a-e311-408c-9cdc-b2aaa07472e4" x="286" y="0" width="70" height="22"/>
                <box>
                    <pen lineWidth="0.25"/>
                    <topPen lineWidth="0.25"/>
                    <leftPen lineWidth="0.25"/>
                    <bottomPen lineWidth="0.25"/>
                    <rightPen lineWidth="0.25"/>
                </box>
                <staticText>
                    <reportElement uuid="fc65b622-66f2-475a-b494-07a1771eed54" x="0" y="0" width="70" height="22"/>
                    <textElement textAlignment="Center" verticalAlignment="Middle">
                        <font size="6" isBold="true"/>
                    </textElement>
                    <text><![CDATA[Department Tests Passed]]></text>
                </staticText>
            </frame>
            <frame>
                <reportElement uuid="cb889940-b86a-4393-a36b-29c9b231936e" x="356" y="0" width="70" height="22"/>
                <box>
                    <pen lineWidth="0.25"/>
                    <topPen lineWidth="0.25"/>
                    <leftPen lineWidth="0.25"/>
                    <bottomPen lineWidth="0.25"/>
                    <rightPen lineWidth="0.25"/>
                </box>
                <staticText>
                    <reportElement uuid="ffa22e5a-37d8-47f1-baf2-69c4f496177e" x="0" y="0" width="70" height="22"/>
                    <textElement textAlignment="Center" verticalAlignment="Middle">
                        <font size="6" isBold="true"/>
                    </textElement>
                    <text><![CDATA[Authorities Conducting Test]]></text>
                </staticText>
            </frame>
            <frame>
                <reportElement uuid="46b8dc97-d986-4a5d-a25a-dff5c2f0bead" x="426" y="0" width="70" height="22"/>
                <box>
                    <pen lineWidth="0.25"/>
                    <topPen lineWidth="0.25"/>
                    <leftPen lineWidth="0.25"/>
                    <bottomPen lineWidth="0.25"/>
                    <rightPen lineWidth="0.25"/>
                </box>
                <staticText>
                    <reportElement uuid="7ba51474-69f6-40c5-8b92-b49619b726d9" x="0" y="0" width="70" height="22"/>
                    <textElement textAlignment="Center" verticalAlignment="Middle">
                        <font size="8" isBold="true"/>
                    </textElement>
                    <text><![CDATA[Month of Passing ]]></text>
                </staticText>
            </frame>
        </band>
    </columnHeader>
    <detail>
        <band height="20" splitType="Stretch">
            <frame>
                <reportElement uuid="f54ea2b3-a412-4bd6-9312-3b919b856e09" x="496" y="0" width="69" height="20"/>
                <box>
                    <pen lineWidth="0.25"/>
                    <topPen lineWidth="0.25"/>
                    <leftPen lineWidth="0.25"/>
                    <bottomPen lineWidth="0.25"/>
                    <rightPen lineWidth="0.25"/>
                </box>
                <textField>
                    <reportElement uuid="7e7c2ebd-7318-48de-901a-2a18cf56b8ec" x="0" y="0" width="69" height="20"/>
                    <textElement textAlignment="Center" verticalAlignment="Middle">
                        <font size="6" isBold="true"/>
                    </textElement>
                    <textFieldExpression><![CDATA[$F{yrSpTestPassed} == null ? "" : $F{yrSpTestPassed}]]></textFieldExpression>
                </textField>
            </frame>
            <frame>
                <reportElement uuid="42e4a7ae-8b82-4c92-81b9-aa97cfad692f" x="426" y="0" width="70" height="20"/>
                <box>
                    <pen lineWidth="0.25"/>
                    <topPen lineWidth="0.25"/>
                    <leftPen lineWidth="0.25"/>
                    <bottomPen lineWidth="0.25"/>
                    <rightPen lineWidth="0.25"/>
                </box>
                <textField>
                    <reportElement uuid="c0eaaedc-1845-4f32-bf9d-d12bfc889137" x="0" y="0" width="70" height="20"/>
                    <textElement textAlignment="Center" verticalAlignment="Middle">
                        <font size="6" isBold="true"/>
                    </textElement>
                    <textFieldExpression><![CDATA[$F{monthSptestPassed} == null ? "" : $F{monthSptestPassed}]]></textFieldExpression>
                </textField>
            </frame>
            <frame>
                <reportElement uuid="7be88968-cba5-41a7-acbf-3bea5d4ceca5" x="356" y="0" width="70" height="20"/>
                <box>
                    <pen lineWidth="0.25"/>
                    <topPen lineWidth="0.25"/>
                    <leftPen lineWidth="0.25"/>
                    <bottomPen lineWidth="0.25"/>
                    <rightPen lineWidth="0.25"/>
                </box>
                <textField>
                    <reportElement uuid="33eb963a-4d9d-4652-b75f-d6c3d093fe88" x="0" y="0" width="70" height="20"/>
                    <textElement textAlignment="Center" verticalAlignment="Middle">
                        <font size="6" isBold="true"/>
                    </textElement>
                    <textFieldExpression><![CDATA[$F{athConducTest} == null ? "" : $F{athConducTest}]]></textFieldExpression>
                </textField>
            </frame>
            <frame>
                <reportElement uuid="2fae729e-37b5-411a-a2e1-601352be2884" x="0" y="0" width="56" height="20"/>
                <box>
                    <pen lineWidth="0.25"/>
                    <topPen lineWidth="0.25"/>
                    <leftPen lineWidth="0.25"/>
                    <bottomPen lineWidth="0.25"/>
                    <rightPen lineWidth="0.25"/>
                </box>
                <textField>
                    <reportElement uuid="6b5428ba-f388-48aa-8748-6c414649e2b8" x="0" y="0" width="56" height="20"/>
                    <textElement textAlignment="Center" verticalAlignment="Middle">
                        <font size="6" isBold="true"/>
                    </textElement>
                    <textFieldExpression><![CDATA[$F{training} == null ? "" : $F{training}]]></textFieldExpression>
                </textField>
            </frame>
            <frame>
                <reportElement uuid="0bd64cca-2b36-4348-befd-ca92a9d1f20d" x="56" y="0" width="56" height="20"/>
                <box>
                    <pen lineWidth="0.25"/>
                    <topPen lineWidth="0.25"/>
                    <leftPen lineWidth="0.25"/>
                    <bottomPen lineWidth="0.25"/>
                    <rightPen lineWidth="0.25"/>
                </box>
                <textField>
                    <reportElement uuid="9f0c128b-ff83-4fad-bdfc-23a8f3596bc7" x="0" y="0" width="56" height="20"/>
                    <textElement textAlignment="Center" verticalAlignment="Middle">
                        <font size="6" isBold="true"/>
                    </textElement>
                    <textFieldExpression><![CDATA[$F{trainingPeriod} == null ? "" : $F{trainingPeriod}]]></textFieldExpression>
                </textField>
            </frame>
            <frame>
                <reportElement uuid="ad1ff6e9-6f2d-4638-ad7e-d329c881a9a3" x="112" y="0" width="56" height="20"/>
                <box>
                    <pen lineWidth="0.25"/>
                    <topPen lineWidth="0.25"/>
                    <leftPen lineWidth="0.25"/>
                    <bottomPen lineWidth="0.25"/>
                    <rightPen lineWidth="0.25"/>
                </box>
                <textField>
                    <reportElement uuid="9526c843-6f77-4e95-90ed-f556e9541804" x="0" y="0" width="56" height="20"/>
                    <textElement textAlignment="Center" verticalAlignment="Middle">
                        <font size="6" isBold="true"/>
                    </textElement>
                    <textFieldExpression><![CDATA[$F{traingingAdd} == null ? "" : $F{traingingAdd}]]></textFieldExpression>
                </textField>
            </frame>
            <frame>
                <reportElement uuid="3bc0434c-8b3b-4b29-b878-212ad05eb1e9" x="168" y="0" width="56" height="20"/>
                <box>
                    <pen lineWidth="0.25"/>
                    <topPen lineWidth="0.25"/>
                    <leftPen lineWidth="0.25"/>
                    <bottomPen lineWidth="0.25"/>
                    <rightPen lineWidth="0.25"/>
                </box>
                <textField>
                    <reportElement uuid="76d0e0de-5eee-4eff-90fb-aff42aac0c08" x="0" y="0" width="56" height="20"/>
                    <textElement textAlignment="Center" verticalAlignment="Middle">
                        <font size="6" isBold="true"/>
                    </textElement>
                    <textFieldExpression><![CDATA[$F{noofgovtorderauth} == null ? "" : $F{noofgovtorderauth}]]></textFieldExpression>
                </textField>
            </frame>
            <frame>
                <reportElement uuid="3ec19bf2-4b25-4b90-9f39-b6ccb43dd34d" x="224" y="0" width="52" height="20"/>
                <box>
                    <pen lineWidth="0.25"/>
                    <topPen lineWidth="0.25"/>
                    <leftPen lineWidth="0.25"/>
                    <bottomPen lineWidth="0.25"/>
                    <rightPen lineWidth="0.25"/>
                </box>
                <textField>
                    <reportElement uuid="ea0eaeda-2ec5-4a53-94c7-15adf562195a" x="0" y="0" width="52" height="20"/>
                    <textElement textAlignment="Center" verticalAlignment="Middle">
                        <font size="6" isBold="true"/>
                    </textElement>
                    <textFieldExpression><![CDATA[$F{authapprovingentry} == null ? "" : $F{authapprovingentry}]]></textFieldExpression>
                </textField>
            </frame>
            <frame>
                <reportElement uuid="42c9ac52-7bab-459c-ab33-46ceddb457ce" x="286" y="0" width="70" height="20"/>
                <box>
                    <pen lineWidth="0.25"/>
                    <topPen lineWidth="0.25"/>
                    <leftPen lineWidth="0.25"/>
                    <bottomPen lineWidth="0.25"/>
                    <rightPen lineWidth="0.25"/>
                </box>
                <textField>
                    <reportElement uuid="f4103ab1-302a-4fcd-ba72-55a513908cd1" x="0" y="0" width="70" height="20"/>
                    <textElement textAlignment="Center" verticalAlignment="Middle">
                        <font size="6" isBold="true"/>
                    </textElement>
                    <textFieldExpression><![CDATA[$F{deptTestpassed} == null ? "" : $F{deptTestpassed}]]></textFieldExpression>
                </textField>
            </frame>
        </band>
    </detail>
    <pageFooter>
        <band height="22" splitType="Stretch">
            <textField>
                <reportElement uuid="365b763c-e73c-422b-95df-f5d266e8eef9" x="147" y="0" width="263" height="22"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="5"/>
                </textElement>
                <textFieldExpression><![CDATA[$P{FooterDetail}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement uuid="34537f7b-871f-415c-8f13-922ae39b42f2" x="486" y="-1" width="79" height="23"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="6"/>
                </textElement>
                <textFieldExpression><![CDATA["Page "+$V{PAGE_NUMBER}+" of"]]></textFieldExpression>
            </textField>
            <textField evaluationTime="Report">
                <reportElement uuid="44f33411-71a5-46aa-85ab-be33124bdf34" x="523" y="-1" width="40" height="23"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="6"/>
                </textElement>
                <textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
            </textField>
            <line>
                <reportElement uuid="d3941b30-335d-43c0-8fc2-ac6f1170220b" x="0" y="1" width="565" height="1"/>
            </line>
            <textField>
                <reportElement uuid="64ee6dbd-8361-4880-bc90-999d9775dbb7" x="0" y="2" width="28" height="20"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="5"/>
                </textElement>
                <textFieldExpression><![CDATA[$P{Date}]]></textFieldExpression>
            </textField>
        </band>
    </pageFooter>
</jasperReport>

动作.java

public void generatePDF(){
        System.out.println("Entering Action : generatePDF");
        String selectedOption=getBean().getSection1Bean().getSelectionsearchOption(); 
        String slash = PropertyReader.get("slash");
        String selectionReportFile=null;
        String trainingReport=null;
        String printFileName = null;
        if(selectedOption.equals("training")){
            List<Section2Bean>section2BeanList = getBean().getSection2Bean().getSearchTraingingList();
            List<Section2Bean>seaction2DeptTest=getBean().getSection2Bean().getSearchdeptTestList();
            List<Section2Bean>searchAllList=new ArrayList<Section2Bean>();
            searchAllList.addAll(seaction2DeptTest);
            searchAllList.addAll(section2BeanList);
            selectionReportFile = PropertyReader.get("jasper.file.location")+slash+"TrainingReport.jasper";
              JRBeanCollectionDataSource beanColDataSource = new JRBeanCollectionDataSource(searchAllList);
               Map parameters = new HashMap();
               String govtLogo=PropertyReader.get("image.file.location")+slash+"Emblem.png";
               String =PropertyReader.get("image.file.location")+slash+"tnwrd.png";
               String fileDate = CommonUtils.currentDateFormatdf.format(new Date());
                parameters.put("ReportName", "Tank Report");
//              parameters.put("Report Taken On", "Report Taken On"); 
                parameters.put("Date", fileDate); 
                parameters.put("Title", "GOVERNMENT OF XXXX"); 
                parameters.put("SubTitle", "XXXXX DEPARTMENT XXXX");  
                parameters.put("FooterDetail", "Computer generated report(no signature obtained)");
                parameters.put("XXXXtlogo", govtLogo);
                parameters.put("XXXXX", );
                try {

                  printFileName = JasperFillManager.fillReportToFile(selectionReportFile, parameters, beanColDataSource);
                  if(printFileName != null){
                    trainingReport= PropertyReader.get("report.file.location")+slash+"Tank_Report.pdf";
                        JasperExportManager.exportReportToPdfFile(printFileName,trainingReport);
                        getSession().setAttribute("fullPath", trainingReport);
               }
               } catch (JRException e) {
                  e.printStackTrace();
               }
        }
        if(selectedOption.equals("training")){

        }


        System.out.println("Leaving Action : generatePDF");
    }

在此处输入图像描述

4

0 回答 0