Scriptlets

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 the scriptlets must extend either net.sf.jasperreports.engine.JRAbstractScriptlet ornet.sf.jasperreports.engine.JRDefaultScriptlet. Following is a brief explanation on these classes:

  • JRAbstractScriptlet: This 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: This is a convenience class containing default empty implementations of every method in JRAbstractScriptlet. It can be used whenever we wish to override only a few of the methods in JRAbstractScriptlet ...

Get JasperReports 3.5 for Java Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.