The so-called subreport expression is introduced by the <subreportExpression> element and can
return values from the following classes:
java.lang.String
java.io.File
java.net.URL
java.io.InputStream
dori.jasper.engine.JasperReport
When the subreport expression returns a java.lang.String value, the engine will try to
see whether the value represents an URL from which to load the subreport design object. If
it is not a valid URL representation, it will try to locate a file on disk and load the subreport
design from it, assuming that the value represents a file name. If no file is found, it will
finally assume that the string value represents the location of a classpath resource and will
try to load the subreport design from there. Only if all those fail, an exception will be
thrown.
If the image expression class is not specified using the class attribute, it is assumed to be
java.lang.String, by default.
Caching Subreports
A subreport element can load different subreport designs with every evaluation, giving you great
flexibility in shaping you documents.
However, most of the time, the subreport elements on a report are in fact static and their source do not
necessarily change with every new evaluation of the subreport expression. In the majority of cases, the
subreport designs are loaded from fixed locations: files on disk or static URLs.
If the same subreport design is filled multiple times on a report, there is no point on loading the
subreport design object from the source file every time we have to fill it with data.
本文来自电脑杂谈,转载请注明本文网址:
https://www.pc-fly.com/a/ruanjian/article-30468-63.html
但是偏偏三哥就是不开窍