Jump to content
We've recently updated our Privacy Statement, available here ×

Scriptlet Issue


ziden

Recommended Posts

 Hello there everyone.

Im having a little issue using a pre-made scriptlet, and i belive this is related to classpathing.

 

This is the dir path to the scriptlets:

C:\DesenWeb\Acad\acad\WEB-INF\classes\pckAcadRelatorios\Scriptlets

 

this is the classpath ive added into ireport options

 

C:\DesenWeb\Acad\acad\WEB-INF\classes\

 

then , i added the scriptlet as:

pckAcadRelatorios.Scriptlets.HeadingsScriptlet

 

it finds the scriptlet to compile the report.

 

i also add the scriptlet using a parameter REPORT_SCRIPTLET like this:

HeadingsScriptlet myscriptlet = new HeadingsScriptlet();

        parameters.put("REPORT_SCRIPTLET", myscriptlet);

 

But then, during the report i have the following:

 

<printWhenExpression><![CDATA[(pckAcadRelatorios.Scriptlets.HeadingsScriptlet)($P{REPORT_SCRIPTLET}).addHeading("ShipCountryGroup")]]></printWhenExpression>

 

When i run the application that creates the PDF, it gets me the following error:

 

Error evaluating expression : 

        Source text: (pckAcadRelatorios.Scriptlets.HeadingsScriptlet)($P{REPORT_SCRIPTLET}).addHeading("ShipCountryGroup")

 

Anything am i doing wrong ? Ive tryed adding the wholeclasspath, no deal, tryed many things couldnt make this work. Any ideas ?

 

thanx for any attention !

 

 []´s Ziden

 

 

 

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

It may not be your whole issue, but what I can say:

First, do not include the REPORT_SCRIPTLET parameter; you should only add the class name as the Report Scriptlet on the report properties; Jasper will create the scriptlet when needed;

Second, this code is wrong: (pckAcadRelatorios.Scriptlets.HeadingsScriptlet)($P{REPORT_SCRIPTLET}).addHeading("ShipCountryGroup")

This way you are casting to the scriptlet class the result of the 'addHeading' call. Rewrite it like this: $P{REPORT_SCRIPTLET}.addHeading("ShipCountryGroup")

Third, 'printWhenExpression' must evaluate to a boolean, telling if the field should be displayed (true) or not (false). 'addHeading' souds like a method that do the actual heading addition, so it should be in the 'expression' field.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...