Problems in ireport Master/Slave reports [reprint]

Source: Internet
Author: User

IReport Problems in Master/Slave reports [Reproduced]I recently encountered the following problems when I used ireport and jasperreport for web reports:
In ireport, after the Master/Slave report is created, the ireport can be compiled, run, and displayed properly. However, the following error occurs when you add the report to javaweb:
Cocould not load object from location: subunitlab. Jasper, that is, the template (Jasper) file of the subreport cannot be found in the main report.
   Main reasons:
The master report cannot find the Jasper file of the subreport (in-depth analysis)
In the main report, set the variable subreport_dir (new if it does not exist) to represent the true path of the subreport template file. Set the subreport expression value of the subreport attribute: $ P {subreport_dir} + "subreportname. jasper ", through the program to dynamically set subreport_dir, so that the winner report can obtain the true path of the subreport template file.
   The procedure is as follows:
1. Set the main report variable: subreport_dir
Set Default Value à modify à select subreport_dir variable name à parameters à Veiw expression value :"";
2. Modify subreport attributes
Right-click the subreport in the main report, select the subreport (other) option, and set the subreport expression value to $ P {subreport_dir} + "subreportname. Jasper"
3. dynamically obtain the true path of the subreport in action and set it to the value of subreport_dir: Param. setparameters ("subreport_dir", request. getrealpath ("/reports/") + "/");
For multiple subreports, the procedure is similar. You only need to set the subreport attributes (premise: All subreports are stored in the same path). If they are stored in different paths, you must create multiple variables in the main report that represent the sub-Report path, correspond to each sub-Report one by one, and set the true path one by one through the program.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.