Grails IReport Jasper返回空白页面 [英] Grails IReport Jasper returns blank page
问题描述
我有这个问题,不得不在我的grails应用程序上显示我的碧玉报告。
在应用程序中,我使用以下命令安装了jasper插件: grails> install-plugin jasper
我创建了 sample.jrxml
拥有这个上下文:
I have this problem having to display my jasper report on my grails application.
On the application I've installed the jasper plugin using the command: grails> install-plugin jasper
I have created sample.jrxml
having this context:
<?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标记< g: jasperReport jasper =studentformat =PDF/>
或创建一个新的闭包,使用此代码将.pdf文件直接显示给浏览器:
And I am calling the report either using the Jasper Tag <g:jasperReport jasper="student" format="PDF"/>
or creating a new closure that would display the .pdf file directly to the browser using this code:
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()
}
使用的任何一种方法都会返回一个空白
Either of the methods used returns a single blank page.
如何解决此问题?
谢谢
Thanks
推荐答案
我可能必须在这个链接伴随着Jasper自己提供的例子,它提供了这里 a>。
I may have to resolve to the tutorials provided by Grails in this link accompanied by the example given by Jasper itself provided here.
这篇关于Grails IReport Jasper返回空白页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!