I am using grails and I have this Jasper report with a subreport in it.
Having this simple two jasper reports
Note: Only .jrxml is the file extension of the files inside the /web-app/reports
Main Report [main_report][subreport area]
<subreport>
<reportElement x="0" y="0" width="555" height="157"/>
<subreportExpression>
<![CDATA[$P{SUBREPORT_DIR} + "test_report.jasper"]]>
</subreportExpression>
</subreport>
Test report [test_report][title.band]
<staticText>
<reportElement x="203" y="30" width="154" height="34"/>
<textElement/>
<text><![CDATA[Hello World]]></text>
</staticText>
And looking in the view or the gsp file I have this command
<g:jasperReport jasper="main_report"
format="pdf, html"
delimiter=" "/>
When I want to view the report in either PDF of HTML format, the report returns a blank page. Am I missing something to display the main_report properly with a subreport test_report.
You need to:
.jasperfile for sub report in reports dir.params.SUBREPORT_DIR = servletContext.getRealPath('/reports') + "/"(assuming the compiled subreport is in the
<app>/web-app/reportsdirectory, the same as the uncompiled reports).