JasperReports allows us to execute snippets of Java code at certain points during the report filling process. We can accomplish this by writing scriptlets. All scriptlets must extend either net.sf.jasperreports.engine.JRAbstractScriptlet
or net.sf.jasperreports.engine.JRDefaultScriptlet
. Following is a brief explanation on these classes:
JRAbstractScriptlet
contains a number of abstract methods that must be overridden in every implementation. These methods are called automatically by JasperReports at the appropriate moment.JRDefaultScriptlet
is a convenience class containing default empty implementations of every method inJRAbstractScriptlet
. It can be used whenever we wish to override only a few of the methods inJRAbstractScriptlet
.
The following table summarizes these methods:
Method |
Description |
---|---|
|
Called before report initialization. |
|
Called after report initialization. |
|
Called... |