the data source or from parameters. In the majority of cases, they are loaded from files on disk and
represent logos and other static resources.
If we have to display the same image multiple times on a report, if it is about a logo appearing on the
page header for example, there is no point on loading the image file every time we have to display it.
We can instruct the reporting engine to cache this particular image. This way we are making sure that
the image will be loaded from disk or from its particular location only once and then it will only be
reused every time it has to be displayed.
By setting the isUsingCache attribute to "true", the reporting engine will try to recognize
previously loaded images using their specified source. For example, it will recognize an image if the
image source is a file name that it has already loaded, or if it is the same URL.
This caching functionality is available only for image elements that have expressions returning
java.lang.String objects as the image source, representing file names, URLs or classpath
resources. That's because the engine uses the image source string as the key to recognize that it is the
same image that it has already cached.
Evaluating Images
As we have already seen when talking about text fields, you have the possibility to postpone the
evaluation of the image expression, which by default is performed immediately.
This would allow you to display in some region of a document, images that are going to be built or
本文来自电脑杂谈,转载请注明本文网址:
https://www.pc-fly.com/a/ruanjian/article-30468-55.html