gpt4 book ai didi

grails - Grails IReport Jasper返回空白页

转载 作者:行者123 更新时间:2023-12-02 14:54:42 25 4
gpt4 key购买 nike

我有这个问题,必须在我的grails应用程序上显示我的jasper报告。
在应用程序上,我使用以下命令安装了jasper插件:grails> install-plugin jasper我创建了具有以下上下文的sample.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="student" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
<property name="ireport.zoom" value="1.2100000000000002"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="79" splitType="Stretch">
<staticText>
<reportElement x="181" y="0" width="212" height="37"/>
<textElement textAlignment="Center">
<font size="24"/>
</textElement>
<text><![CDATA[Portal Student List]]></text>
</staticText>
</band>
</title>
<columnHeader>
<band height="26"/>
</columnHeader>
<detail>
<band height="98" splitType="Stretch"/>
</detail>
<columnFooter>
<band height="43" splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="54" splitType="Stretch">
<staticText>
<reportElement x="238" y="0" width="100" height="20"/>
<textElement textAlignment="Center"/>
<text><![CDATA[Copyright]]></text>
</staticText>
</band>
</pageFooter>
</jasperReport>

我正在使用Jasper Tag <g:jasperReport jasper="student" format="PDF"/>调用报告,或者创建一个新的闭包,使用此代码将.pdf文件直接显示给浏览器:
def report() {
def reportDef = new JasperReportDef(folder: 'reports', name:'student.jrxml', fileFormat: JasperExportFormat.PDF_FORMAT)
reportDef.contentStream = jasperService.generateReport(reportDef)

response.contentType = reportDef.fileFormat.mimeTyp
response.characterEncoding = 'UTF-8'
response.outputStream << reportDef.contentStream.toByteArray()
}

所用的任何一种方法都返回一个空白页。

我该如何解决这个问题?

谢谢

最佳答案

我可能必须解析Grails在此link中提供的教程,以及Jasper本身提供的here给出的示例。

关于grails - Grails IReport Jasper返回空白页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11257078/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com