hussainian Posted December 19, 2009 Share Posted December 19, 2009 Hi!I want to use a scriptlet class with my JasperReport. Can anyone please tell me how to add it to the class path? Also I read that use the fully qualified name in the Class attribute of SCRIPTLET tag. What if I don't have any package. I mean what if I place the Scriptlet Class file in the same folder where .JRXML file is placed?Thanks. Link to comment Share on other sites More sharing options...
rakeshenoch Posted December 21, 2009 Share Posted December 21, 2009 Classpath is set so that the jasper engine knows where to find the scriptlet. If your scriptlet is in the same location as your reports, I think you still have to set the path to this folder. You can set the classpath from Tools --> Options Menu. Also make sure that the scriptlet is compiled before you run the reports Link to comment Share on other sites More sharing options...
hussainian Posted December 22, 2009 Author Share Posted December 22, 2009 My report runs without any errors. But the Scriptlet Class doesn't seem to work. Link to comment Share on other sites More sharing options...
rakeshenoch Posted December 22, 2009 Share Posted December 22, 2009 Can you share your code and report Link to comment Share on other sites More sharing options...
hussainian Posted December 22, 2009 Author Share Posted December 22, 2009 Here are both. The thing I'm trying to do is that before report init, a stored procedure will be called, which will fill a table in databse. And then the query if report will fetch data from that table. By now, the report is empty which means that the procedure is not called and the table is not populated. Thanks for help. Link to comment Share on other sites More sharing options...
lucianc Posted December 22, 2009 Share Posted December 22, 2009 Your report doesn't have a scriptletClass attribute. You need to set that attribute in order to use a scriptlet.Regards,Lucian Link to comment Share on other sites More sharing options...
hussainian Posted December 23, 2009 Author Share Posted December 23, 2009 <scriptlet name="TestScript" class="TestScript"/>Isn't it the scriptlet tag? Or I need any additional thing? Link to comment Share on other sites More sharing options...
rakeshenoch Posted December 23, 2009 Share Posted December 23, 2009 According to lucianc,You don't have the "scriptletClass" attribute declared in your jrxml. This attribute can be found in the "jasperReport" element of the report XML Link to comment Share on other sites More sharing options...
hussainian Posted December 23, 2009 Author Share Posted December 23, 2009 I changed the code. And now it is like <jasperReport xmlns="ht... scriptletClass="f1.f2.TestScript"> <scriptlet name="TestScript" class="f1.f2.TestScript"/> I've a jar file added in the iReport Classpath which has the Class file in the hierarchy written above. Still not working. Link to comment Share on other sites More sharing options...
lucianc Posted December 23, 2009 Share Posted December 23, 2009 My bad, I missed the <scriptlet> element. That should be fine, you don't need the scriptletClass attribute.How do you determine that the scritplet class is not working? What happens if you use a non-existing class name (e.g. f1.f2.TestScriptFoo)?Regards,Lucian Link to comment Share on other sites More sharing options...
hussainian Posted December 24, 2009 Author Share Posted December 24, 2009 I changed the class name and got error. It means file is found. But then why the required task is not being accomplished. I've changed the task in the files attached now, making them more simple. Kindly check them. Link to comment Share on other sites More sharing options...
lucianc Posted December 30, 2009 Share Posted December 30, 2009 You need to set calculation="System" for the variable whose value you want to set in the scriptlet.Regards,Lucian Link to comment Share on other sites More sharing options...
hussainian Posted December 31, 2009 Author Share Posted December 31, 2009 Amazingly, the same thing, which was not working on iReport's stand alone version, worked on NetBeans' iReport plugin. Link to comment Share on other sites More sharing options...
lucianc Posted December 31, 2009 Share Posted December 31, 2009 Then it might be an iReport bug. You could try posting a question on the iReport forum at http://jasperforge.org/plugins/espforum/browse.php?group_id=83&forumid=101Regards,Lucian 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