on 10-03-2011 8:39 PM
I'm getting an error trying to display a report in a JSP page, but without an error message. I'll explain what I've coded, first.
<br/><br/>
I have a backing bean called reportController that has a reportSource property of type com.crystaldecisions.sdk.occa.report.reportsource.IReportSource. That property is initialised with the following code:
<br/><br/>
<pre>reportSource = reportsBean.processReport()</pre>
<br/><br/>
where processReport() is:
<br/><br/>
<pre>public IReportSource processReport()
throws NullPointerException, SQLException, ReportSDKException {
IReportSource reportSource = null;
ReportClientDocument reportClientDoc = new ReportClientDocument();
reportClientDoc.open("myReport.rpt", 0);
// where my jdbc/jndi name is "jdbc/MyApp"
CRJavaHelper.changeDataSource(reportClientDoc, "MyApp");
reportSource = reportClientDoc.getReportSource();
return reportSource;
}
private static void changeDataSource(ReportClientDocument clientDoc, String jndiName)
throws ReportSDKException {
ITable origTable = null;
ITable newTable = null;
String JNDI_DATASOURCE_NAME = jndiName;
String SERVER_TYPE = "JDBC (JNDI)";
String USE_JDBC = "true";
String DATABASE_DLL = "crdb_jdbc.dll";
IConnection oldConnection = clientDoc.getDatabaseController().getDatabase().
getConnections().getConnection(0);
IConnection newConnection = (IConnection) oldConnection.clone(true);
IConnectionInfo connectionInfo = new ConnectionInfo();
PropertyBag propertyBag = new PropertyBag();
propertyBag.put(PropertyBagHelper.CONNINFO_SERVER_TYPE, SERVER_TYPE);
propertyBag.put("Use JDBC", USE_JDBC);
propertyBag.put(PropertyBagHelper.CONNINFO_DATABASE_DLL, DATABASE_DLL);
propertyBag.put("Initial Context", "/");
propertyBag.put(PropertyBagHelper.JNDI_OPTIONALNAME, JNDI_DATASOURCE_NAME);
connectionInfo.setAttributes(propertyBag);
newConnection.setConnectionInfo(connectionInfo);
clientDoc.getDatabaseController()
.replaceConnection(oldConnection, newConnection, DBOptions._doNotVerifyDB);
Tables tables = clientDoc.getDatabaseController()
.getDatabase().getTables();
for (int i = 0; i < tables.size(); i++) {
origTable = tables.getTable(i);
newTable = (ITable) origTable.clone(true);
newTable.setQualifiedName(origTable.getAlias());
connectionInfo = newTable.getConnectionInfo();
propertyBag = new PropertyBag();
propertyBag.put(PropertyBagHelper.CONNINFO_SERVER_TYPE, SERVER_TYPE);
propertyBag.put("Use JDBC", USE_JDBC);
propertyBag.put(PropertyBagHelper.CONNINFO_DATABASE_DLL, DATABASE_DLL);
propertyBag.put("Initial Context", "/");
propertyBag.put(PropertyBagHelper.JNDI_OPTIONALNAME, JNDI_DATASOURCE_NAME);
connectionInfo.setAttributes(propertyBag);
clientDoc.getDatabaseController().setTableLocation(origTable, newTable);
}
IStrings subNames = clientDoc.getSubreportController().getSubreportNames();
for (int subNum = 0; subNum < subNames.size(); subNum++) {
Tables tables = clientDoc.getSubreportController()
.getSubreport(subNames.getString(subNum)).getDatabaseController()
.getDatabase().getTables();
for (int i = 0; i < tables.size(); i++) {
origTable = tables.getTable(i);
newTable = (ITable) origTable.clone(true);
newTable.setQualifiedName(origTable.getAlias());
connectionInfo = newTable.getConnectionInfo();
propertyBag = new PropertyBag();
propertyBag = new PropertyBag();
propertyBag.put(PropertyBagHelper.CONNINFO_SERVER_TYPE, SERVER_TYPE);
propertyBag.put("Use JDBC", USE_JDBC);
propertyBag.put(PropertyBagHelper.CONNINFO_DATABASE_DLL, DATABASE_DLL);
propertyBag.put("Initial Context", "/");
propertyBag.put(PropertyBagHelper.JNDI_OPTIONALNAME, JNDI_DATASOURCE_NAME);
connectionInfo.setAttributes(propertyBag);
connectionInfo.setAttributes(propertyBag);
clientDoc.getSubreportController().getSubreport(subNames.getString(subNum))
.getDatabaseController()
.setTableLocation(origTable, newTable);
}
}
}</pre>
<br/><br/>
My page is:<br/>
<pre>
<f:view>
<crviewer:viewer displayGroupTree="false"
viewerName="CrystalViewer"
reportSourceType="reportingComponent"
displayToolbarExportButton="true"
displayToolbarPrintButton="true"
displayToolbarRefreshButton="true"
displayToolbarToggleTreeButton="false"
displayToolbarCrystalLogo="true"
top="100"
left="200"
reportSourceVar="#{reportController.reportSource}"
isOwnPage="true"
allowDatabaseLogonPrompting="false"
printMode="PDF" >
<crviewer:partsViewer viewerName="CrystalPartsViewer"
reportSourceType="reportingComponent"
title="Fill to Fill Report"
numberOfRecords="10"
showHeadings="true"
showPageNavigationLinks="true"
allowParameterPrompting="false"
reportSourceVar="#{reportController.reportSource}"/>
</crviewer:viewer>
</f:view></pre>
<br/><br/>
I have my report files stored in my WEB-INF/classes folder.
<br/><br/>
But I get the following message from the viewer (html source):
<br/><br/>
<pre>
<table class="crExceptionBorder" width="100%" cellspacing=1 cellpadding=0 border=0>
<tr><td class="crExceptionHeader">Error</td></tr>
<tr>
<td>
<table width="100%" border=0 cellpadding=5 cellspacing=0>
<tr>
<TD class="crExceptionElement">
<table border=0 cellpadding=5 cellspacing=0>
<tr><td><span class="crExceptionText"></span></td></tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</html></pre>
<br/><br/>
I'm just trying to get this working, and I've seen the reportSource object created and modified when I debug the application. The only problem is actually displaying the report, I believe. I think I have the JSP page correct, but I can't really find any useful documentation on the JSF component and how to use each of the attributes. Anyway, I can't get any reports to show.
If you enable Log4J logging, does it show greater detail concerning the issue?
Sincerely,
Ted Ueda
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.