• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 798
  • Last Modified:

Eclipse Crystal Report XI pass more than one pojo object from JSP to Crystal Report

I'm using Crystal Report XI for Java, and in my sample I'm using one Pojo dataset and it works ok, but I would like to know how to pass more than one pojo object to a same report result. ( like having two simple separate tables.)
This is a little peace of code inside the JSP:

String reportName = "submitedContracts.rpt";
ReportClientDocument clientDoc = (ReportClientDocument) session.getAttribute(reportName);
       clientDoc.open(reportName, OpenReportOptions._openAsReadOnly);
 // Populate POJO data source
 String className = "org.tempuri.FDCInformation.FDCInformationSrv.SubmittedContractsBE";
 List dataset = new ArrayList();
 dataset = (List)request.getAttribute("dataSet");
 JRCHelperSample.passPOJO(clientDoc, dataset, className, tableAlias, "");

IReportSource reportSource = clientDoc.getReportSource();
JRCHelperSample.exportPDF(reportSource, request, response, config.getServletContext(), true);

above example just send one Object to crystal report . Do you know how to send more than one object on above code example..? passPOJO just accept one object and I tried to below line after fill my second data set:
 JRCHelperSample.passPOJO(clientDoc, dataset2, className2, tableAlias2, ""); but does not work,

passPOJO method:

public static void passPOJO(ReportClientDocument clientDoc, Collection dataSet,
                  String className, String tableName, String reportName) throws ReportSDKException,ClassNotFoundException{
                  clientDoc.getDatabaseController().setDataSource(dataSet, Class.forName(className),tableName,tableName+"_POJO");
                  clientDoc.getSubreportController().getSubreport(reportName).getDatabaseController().setDataSource(dataSet, Class.forName(className),tableName,tableName+"_POJO");

Thank's in advance.

1 Solution


I'm just jumping head on here as I never used this.
It seems that there is sometihng similar here:
Maybe it helps.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

Tackle projects and never again get stuck behind a technical roadblock.
Join Now