Solved

Need help loading scriplets in Jasper report

Posted on 2004-05-02
13
3,608 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 

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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

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…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

636 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