Jump to content
Changes to the Jaspersoft community edition download ×

Trying subreport sample in webApp

Recommended Posts

By: Uniq - uniq_2002

Trying subreport sample in webApp

2002-10-29 02:15



i am trying your sample subreport in web application.


and my problem is :

(1). in java class :

JasperCompileManager.compileReportToFile ("MasterReport.xml");

i must write the 3 xml in there in 1 class ??


(2).in jsp file :

File reportFile = new File(application.getRealPath("/MasterReport.jasper"));

i must write the 3 xml too in 1 jsp file ??


because after i build *.jasper for every *.xml

and then i run the jsp , i got error message :

" AddressReport.jasper is not found "


all the *.jasper is one directory.


am sorry if this problem is very easier for u...

thanks for any help...:-)














By: Teodor Danciu - teodord

RE: Trying subreport sample in webApp

2002-10-29 13:44




I'm not sure I understand what you mean,

but I'll try to gice you some hints:


1) You have to compile the 3 xml files in order

to produce 3 .jasper files.

This could be done in the same class calling

3 times the compileReportToFile() method.


2) When filling the reports, you call the

fillReportXXX() method only on the

MasterReport.jasper file. Not on all 3 .jasper files.

It is the master report filler that will load the

other 2 .jasper files at runtime.


The problem is that the master filler does not find

the .jasper files for the subreports.


If in the report desing you have wrote:


you have to make sure you add the directory

containing the .jasper files to the classpath of

your application.

In web environment, this is not trivial,

so a different approach should be used.


Check the "webapp" sample to see how the image

present on that report is located.

The base directory for the image is passed as

a report parameter.

Things should be the same with subreports.


The JasperReports Ultimate Guide explains these

things better.


I hope this helps.


Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...