我试图在japer报告中打印arraylist值,但问题是这是我作为输出得到的结果
2014-03-11,2014-03
但是我的数组列表“adhist”应该打印输出为(逐个)
2014-03-11
2014-03
这是我的JavaSpringMVC代码
ArrayList<String> adhist = new ArrayList<String>();
for(int i=0;i<Admission.size();i++){
addhist.add(new AdmissionHistory());
addhist.get(i).setAdmitdate(Admission.get(i).getAdmitdate());
adhist.add(Admission.get(i).getAdmitdate());
addhist.get(i).setDischargedate(Admission.get(i).getDischarge());
if(Admission.get(i).getDischarge().equals("yes")){
addhist.get(i).setDiagnosis(patientService.listdiagnosis(Admission.get(i).getAdmitclinicid()).get(0).getDiagnosis());
}
}
model.put("adhist", adhist);
modelAndView = new ModelAndView("pdfReportView1", model);
这是jasperreport.xml
<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="Patientsummerpdf" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="842" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<parameter name="adhist" class="java.util.List"/>
<field name="fullname" class="java.lang.String"/>
<field name="address" class="java.lang.String"/>
<field name="dob" class="java.lang.String"/>
<field name="gender" class="java.lang.String"/>
<field name="height" class="java.lang.String"/>
<field name="weight" class="java.lang.String"/>
<field name="bloodgrp" class="java.lang.String"/>
<field name="immunstatus" class="java.lang.String"/>
<field name="developstatus" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="19" splitType="Stretch"/>
</title>
<pageHeader>
<band height="30" splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band height="131" splitType="Stretch">
<staticText>
<reportElement x="24" y="60" width="68" height="20"/>
<textElement/>
<text><![CDATA[Full Name]]></text>
</staticText>
<staticText>
<reportElement x="210" y="60" width="68" height="20"/>
<textElement/>
<text><![CDATA[Address]]></text>
</staticText>
<staticText>
<reportElement x="396" y="60" width="68" height="20"/>
<textElement/>
<text><![CDATA[Date of Birth]]></text>
</staticText>
<staticText>
<reportElement x="589" y="60" width="49" height="20"/>
<textElement/>
<text><![CDATA[Gender]]></text>
</staticText>
<textField>
<reportElement x="92" y="60" width="100" height="20"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{fullname}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="278" y="60" width="100" height="20"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{address}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="464" y="60" width="100" height="20"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{dob}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="638" y="60" width="61" height="20"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{gender}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="24" y="94" width="68" height="20"/>
<textElement/>
<text><![CDATA[Height]]></text>
</staticText>
<staticText>
<reportElement x="210" y="94" width="68" height="20"/>
<textElement/>
<text><![CDATA[Weight]]></text>
</staticText>
<staticText>
<reportElement x="396" y="94" width="68" height="20"/>
<textElement/>
<text><![CDATA[Blood Group]]></text>
</staticText>
<textField>
<reportElement x="92" y="94" width="100" height="20"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{height}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="278" y="94" width="100" height="20"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{weight}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="464" y="94" width="100" height="20"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{bloodgrp}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="145" y="0" width="100" height="20"/>
<textElement/>
<text><![CDATA[adhist]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="90" splitType="Stretch">
<textField>
<reportElement x="133" y="32" width="100" height="20"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[""+$P{adhist}]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band height="77" splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="37" splitType="Stretch"/>
</pageFooter>
<summary>
<band height="42" splitType="Stretch"/>
</summary>
</jasperReport>
1条答案
按热度按时间p3rjfoxz1#
我想你唯一需要的就是用碧玉
List
组件来 Package 参数。您可以在ireports调色板中找到它。举个例子: