ziden Posted April 7, 2011 Share Posted April 7, 2011 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 More sharing options...
mdrg Posted April 8, 2011 Share Posted April 8, 2011 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now