Solved

Need help loading scriplets in Jasper report

Posted on 2004-05-02
13
3,563 Views
Last Modified: 2007-12-19
Hi,
I'm running Jasper reports and all well.
Now I need to insert in addition to a regular fields from a query, fields that will do some manipulation with the other fields. for that I need to use the scriptlets.
I have looked at the demo and examples and read the tutorial but nothing on where to put the scriptlet class or where is the ClassPath of the report?
Please advise as much as you can on scriptlets.
Thanks
Jo
0
Comment
Question by:YossiBa
  • 8
  • 5
13 Comments
 
LVL 7

Expert Comment

by:maheshexp
ID: 10971716
0
 
LVL 7

Expert Comment

by:maheshexp
ID: 10971801
0
 

Author Comment

by:YossiBa
ID: 10975337
hi,
Thanks for the quick reply.
I have seen the demo's and couldn't understand quite well the relevence with the guys error to my problem.
I think mine is very basic.
When I'm trying to compile a simple jasper report  that includes  scriptletClass="Scriptlet" as one of the attributes i get a classnotfound error. The report was compiled without this attribute. I put the Scriptlet.class from the samples in the directory the .jasper file is located.
Why doesn't it copiles?
Where should I put the scriptlet.class?
Should there be a classPath to the jasper report?
Where should the scriptlet class path be mensioned for compilation.
Thanks
0
 

Author Comment

by:YossiBa
ID: 10975663
Another remark:
According to JasperReport Manual guid under Scriptlet section, it is said that "The complete name of this scriptlet class (including the package) has to be specified in the scriptletClass attribute of the <jasperReport> element and has to be available in the classpath, at report filling time..........."
Where is that class path?
What classpath? shouldn't I put the location of the class as the attribute?

please advise
0
 
LVL 7

Expert Comment

by:maheshexp
ID: 10976268
>What classpath?
  classpath is a set of location, where the java will search for the required classes for it's execution. eg: String, is java.lang.String, this class is placed in a jar, which should be placed in a CLASSPATH.....

http://mindprod.com/jgloss/classpath.html
0
 
LVL 7

Expert Comment

by:maheshexp
ID: 10976331
You'll need to set the class path for the internal compilation. The class path that you use in any build files doesn't apply automatically. Look under compilation in "quick how to". You'll need to set the "jasper.reports.compile.class.path" system property.

http://jasperreports.sourceforge.net/quick.how.to.html#compile
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 7

Accepted Solution

by:
maheshexp earned 250 total points
ID: 10976345
0
 

Author Comment

by:YossiBa
ID: 10976379
Great, I'll work on it.
Thanks mate
0
 
LVL 7

Expert Comment

by:maheshexp
ID: 10977497
happy programming :-)
0
 

Author Comment

by:YossiBa
ID: 10977832
Thanks again.

Last  small Q if I may:
I have the following fields:

field1   field2
111     222
100     200

I need to create a third field that will do some manipulation  on the 2 first fields (say adding).

I want to create a function in the scriptlet class that will do the work.

Where do I put this function in the scriptlet so that the final report will be:

field1  field2  field3
111    222     333
100    200    300

I tried to set a variable with the result in afterDetailEval() but got null.

If want points I will be gladly give you.
Thanks
0
 
LVL 7

Expert Comment

by:maheshexp
ID: 10978339
how u use the tags for generating field1   field2
0
 

Author Comment

by:YossiBa
ID: 10978520
I managed.
Thanks a lot mate for the help  : )
0
 
LVL 7

Expert Comment

by:maheshexp
ID: 10978611
cool.... :-)
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
The viewer will learn how to implement Singleton Design Pattern in Java.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now