Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Need help loading scriplets in Jasper report

Posted on 2004-05-02
13
Medium Priority
?
3,648 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
 

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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses

971 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