Nuclos JasperReports scriptlet: JRDefaultScriptlet, Scriptlet Class, $P{REPORT_SCRIPTLET}, extension, jasperreports-6.17.0.jar.

globe with meridians Language: Deutsch · English

hammer and wrench Scriptlets

Extend report logic with a Java scriptlet – JRDefaultScriptlet, testing in the designer, registration as an extension.

On this page

What are scriptlets?

Scriptlets are custom Java classes that influence the execution of a report/form. For a simple scriptlet, derive from net.sf.jasperreports.engine.JRDefaultScriptlet (empty default methods) and override only the methods you need.

Workflow

  1. Create the scriptlet class and package it as a JAR.
  2. Test the scriptlet in Jaspersoft Studio.
  3. Register the scriptlet in Nuclos as an extension.

Create the scriptlet class

Test in Jaspersoft Studio

First make the class(es) known to the classpath: Extras → Options → Classpath tab, add the scriptlet JAR (and all dependencies incl. jasperreports-6.17.0.jar) via Add Jar; tick reloadable. For a single scriptlet the full class name in the document property Scriptlet Class is enough. It is called via $P{REPORT_SCRIPTLET}.method() in the image/text expression.

Jaspersoft Studio 6.17.0 has a bug that prevents reports with scriptlets from compiling correctly. Use a different version for testing.

For reports with scriptlets to run in Nuclos, the scriptlets must be registered as server-side extensions.

Related pages

printer Working with Jasper Studio


Overview.

Open →

electric plug Jasper extensions in Nuclos


Register.

Open →