Solved

Need help loading scriplets in Jasper report

Posted on 2004-05-02
13
3,576 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

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
 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
The viewer will learn how to implement Singleton Design Pattern in Java.

816 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

11 Experts available now in Live!

Get 1:1 Help Now