Solved

Need help loading scriplets in Jasper report

Posted on 2004-05-02
13
3,581 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
jar file executable 12 58
jsp login check 12 43
Convert from a json string array to a Java object 3 53
Which non-HTML GUI front end to use with Java? 3 24
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…
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

828 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