actually,
just trying to get the .jsp sample page to work first.......
browsing this page via coldfusion web server.
I believe we have to unpack the .jar file into
C:/CFusionMX/wwwroot/WEB-INF/.........
example page follows:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<[EMAIL PROTECTED]
import="com.crystaldecisions.reports.sdk.ReportClientDocument,
com.crystaldecisions.sdk.occa.report.lib.*,
com.crystaldecisions.sdk.occa.report.data.*,
com.crystaldecisions.sdk.occa.report.lib.PropertyBag,
java.io.*,
com.crystaldecisions.reports.sdk.*"
%>
<%
/* Applies to: XI
* Date Created: April 4, 2005
* Description: This sample application can assist with determining database
connection information that may be
* required when changing database connection
information in a Crystal Report at runtime.
* To help demonstrate how to use this sample, there are 2 sample
reports included: ReportA.rpt and
* ReportB.rpt. These reports are based off 2
different SQL Server databases which use a JDBC
* connection.
* Author: HP, BH
*/
try {
//Create a ReportClientDocument for each report
ReportClientDocument oReportClientDocumentA = new
ReportClientDocument();
ReportClientDocument oReportClientDocumentB = new
ReportClientDocument();
//Parse out the report name using helper function below
String ReportA = getReportName(request.getParameter("ReportA"));
String ReportB = getReportName(request.getParameter("ReportB"));
//Open both reports
oReportClientDocumentA.open("jrc_display_connection_info/" + ReportA,
0);
oReportClientDocumentB.open("jrc_display_connection_info/" + ReportB,
0);
//Display the connection information about a report.
//(code for the ConnInfoDisplayer class is below)
ConnInfoDisplayer report1_displayer = new
ConnInfoDisplayer(oReportClientDocumentA);
ConnInfoDisplayer report2_displayer = new
ConnInfoDisplayer(oReportClientDocumentB);
//Begin a main table to display both reportA and reportB's properties
in.
out.println("<table width='100%' height='100%'>");
out.println("<tr align='center' valign='top'>");
out.println("<td>");
out.println(report1_displayer.getTable(ReportA)); //list out the
properties of Report A
out.println("</td>");
out.println("<td>");
out.println(report2_displayer.getTable(ReportB)); //list out the
properties of Report B
out.println("</td>");
out.println("</tr>");
out.println("</table>"); // End the main table.
//Close the ReportClientDocument to allow the JRC to release the
resources
//tied to each report.
oReportClientDocumentA.close();
oReportClientDocumentB.close();
}
catch(ReportSDKException sdkEx) {
out.println(sdkEx);
}
%>
<%!
/*********************** class ConnInfoDisplayer ***********************
*
* Used to display all the Connection Info properties from the first table
* of the given report in a nice HTML based table.
*
***********************************************************************/
public class ConnInfoDisplayer
{
private ReportClientDocument oReportClientDocument;
/************************************************************************
*
* Constructor - Save the reportClientDocument to be displayed
*
***********************************************************************/
ConnInfoDisplayer(ReportClientDocument oReportClientDocument)
{
this.oReportClientDocument = oReportClientDocument;
}
/************************************************************************
*
* Return the report name section of the table for the main report.
*
***********************************************************************/
private String report_name_section(ReportClientDocument
oReportClientDocument, String theReportName) throws ReportSDKException
{
String reportName = theReportName;
String result = "";
result += "<tr>";
result += "<td colspan=2 align=center
bgcolor='#0C0C6E'><strong><font color='white'>Main Report: " + reportName +
"</font></strong></td>";
result += "</tr>";
result += "<tr>";
result += "<td colspan=2 bgcolor='#CFD0E2'> </td>";
result += "</tr>";
return result;
}
/************************************************************************
*
* Return the report name section of the table for the subreport.
*
***********************************************************************/
private String table_properties_section(ITable oTable)
{
String result = "";
result += "<tr>";
result += "<td colspan=2 bgcolor='#0C0C6E'><strong><font
color='white'>Table Properties</font></strong></td>";
result += "</tr>";
result += "<tr>";
result += "<td bgcolor='#CFD0E2'>Name</td><td
bgcolor='#F1EFE2'>" + oTable.getName() + "</td>";
result += "</tr>";
result += "<tr>";
result += "<td bgcolor='#CFD0E2'>Alias</td><td
bgcolor='#F1EFE2'>" + oTable.getAlias() + "</td>";
result += "</tr>";
result += "<tr>";
result += "<td bgcolor='#CFD0E2'>Qualified Name</td><td
bgcolor='#F1EFE2'>" + oTable.getQualifiedName() + "</td>";
result += "</tr>";
return result;
}
/************************************************************************
*
* Return the connection infos name section.
*
***********************************************************************/
private String conn_info_properties_section(IConnectionInfo
oConnectionInfo)
{
String result = "";
//list out the general Connection properties
result += "<tr>";
result += "<td colspan=2 bgcolor='#0C0C6E'><strong><font
color='white'>ConnectionInfo Properties</font></strong></td>";
result += "</tr>";
result += "<tr>";
result += "<td bgcolor='#CFD0E2'>User Name</td><td
bgcolor='#F1EFE2'>" + oConnectionInfo.getUserName() + "</td>";
result += "</tr>";
result += "<tr>";
result += "<td bgcolor='#CFD0E2'>Password</td><td
bgcolor='#F1EFE2'>" + oConnectionInfo.getPassword() + "</td>";
result += "</tr>";
result += "<tr>";
result += "<td bgcolor='#CFD0E2'>Kind</td><td
bgcolor='#F1EFE2'>" + oConnectionInfo.getKind() + "</td>";
result += "</tr>";
result += "<tr>";
result += "<td colspan=2 bgcolor='#0C0C6E'><strong><font
color='white'>ConnectionInfo Atttribute Properties</font></strong></td>";
result += "</tr>";
return result;
}
/************************************************************************
*
* Return the property bag infos name section. This function will
* recursively go through any property bags that are contained in this
* property bag.
*
***********************************************************************/
private String property_bag_section(PropertyBag oPropertyBag, String
indent)
{
int i;
IStrings prop_ids = null;
String result = "";
prop_ids = oPropertyBag.getPropertyIDs();
String prop_name = "";
for (i=0;i < prop_ids.size(); i++) {
if ( (oPropertyBag.get(prop_ids.get(i))).getClass() !=
oPropertyBag.getClass() ) {
prop_name = (String)prop_ids.getString(i);
String prop_val =
(String)oPropertyBag.getStringValue(prop_ids.get(i));
result += "<tr><td bgcolor='#CFD0E2'>" +
prop_name + "</td><td bgcolor='#F1EFE2'>" + prop_val + "</td></tr>";
} else if
((oPropertyBag.get(prop_ids.get(i))).getClass() == oPropertyBag.getClass() ) {
prop_name = (String)prop_ids.get(i);
result += "<td colspan=2 bgcolor='#CFD0E2'><i>"
+ prop_name + " Properties</i></td>";
result += this.property_bag_section
((PropertyBag)oPropertyBag.get(prop_ids.get(i)), "     ");
} else {
result += " ***** " +
(oPropertyBag.get(prop_ids.get(i))).getClass();
}
}
return result;
}
/************************************************************************
*
* Return the section that includes the reports connection including
* the Connection Infos direct properties, and any property bags it
* contains.
*
***********************************************************************/
private String connection_section(IConnectionInfo oConnectionInfo)
{
String connInfoTable = "";
connInfoTable += conn_info_properties_section(oConnectionInfo);
PropertyBag oPropertyBag = oConnectionInfo.getAttributes();
connInfoTable += property_bag_section(oPropertyBag, "");
return connInfoTable;
}
/************************************************************************
*
* Return the table of Connection Properties as a String to be
displayed.
*
***********************************************************************/
private String table_section(ITable oTable) throws ReportSDKException
{
String connInfoTable = "";
connInfoTable += table_properties_section(oTable);
IConnectionInfo oConnectionInfo =
(IConnectionInfo)oTable.getConnectionInfo();
connInfoTable += connection_section(oConnectionInfo);
return connInfoTable;
}
/************************************************************************
*
* Return the main report section. There should be only one main report
* section per ConnInfoDisplayer.
*
***********************************************************************/
private String mainreport_section(ReportClientDocument
oReportClientDocument, String theReportName) throws ReportSDKException
{
String reportName = theReportName;
String result = "";
//Get the first table from the report. We will display it's
connection properties.
result += "<table border=0 cellspacing=1>";
result += report_name_section(oReportClientDocument,
reportName);
for (int i = 0; i <
oReportClientDocument.getDatabaseController().getDatabase().getTables().size();
i++)
{
ITable oTable =
(ITable)oReportClientDocument.getDatabaseController().getDatabase().getTables().getTable(i);
result += table_section(oTable);
}
result += "</table>";
return result;
}
/************************************************************************
*
* Return an HTML based table of all the connection properties in the
* oReportClientDocument that was passed in to the contructor.
*
***********************************************************************/
public String getTable(String theReportName) throws ReportSDKException
{
String reportName = theReportName;
String result = "";
result += mainreport_section(oReportClientDocument, reportName);
return result;
}
}// End of ConnInfoDisplayer Class
%>
<%!
public String getReportName(String reportlocation)
{
String stringToParse = reportlocation;
//Parse the report location string to get the report name
int indexOfTheLastBackslash = stringToParse.lastIndexOf('\\');
//Increment the index of the last occurence of the backslash by 1
//so that we do not include the backslash as part of the report name
indexOfTheLastBackslash++;
//retrieve the report name
String reportName = stringToParse.substring(indexOfTheLastBackslash);
return reportName;
} //end of getReportName method
%>
>>> "Mark Mandel" <[EMAIL PROTECTED]> 15/02/2008 3:33 pm >>>
Scott,
What are you doing on your cf page?
Mark
On Fri, Feb 15, 2008 at 2:51 PM, Scott Thornton
<[EMAIL PROTECTED]> wrote:
>
> Heya,
>
> I am assisting someone else with a java\cf problem.
>
> Where must a .jar file be located to be referenced correctly?
>
> For example, within a jsp page the import looks like:
>
> <[EMAIL PROTECTED]
> import="com.crystaldecisions.reports.sdk.ReportClientDocument,
> com.crystaldecisions.sdk.occa.report.lib.*,
> com.crystaldecisions.sdk.occa.report.data.*,
>
> com.crystaldecisions.sdk.occa.report.lib.PropertyBag,
> java.io.*,
> com.crystaldecisions.reports.sdk.*"
>
> %>
>
>
> however, we get an error when running the page:
>
> Error Occurred While Processing Request
> Translator.CompilationFailedExceptionCompiler errors: Found 11 semantic
> errors compiling
> "C:/CFusionMX/wwwroot/WEB-INF/jsp/jrun__jrc_display_connection_info__jrc_display_connection_info2ejsp3c.java":
> 5. import com.crystaldecisions.reports.sdk.ReportClientDocument;
> <---------------------------------------------------> *** Error:
> "com/crystaldecisions/reports/sdk/ReportClientDocument" is either a misplaced
> package name or a non-existent entity. 7.
> com.crystaldecisions.sdk.occa.report.lib.*;
> <--------------------------------------> *** Error: Could not find package
> "com/crystaldecisions/sdk/occa/report/lib" in:
> C:\CFusionMX\wwwroot\WEB-INF\classes
> C:\CFusionMX\wwwroot\WEB-INF\lib\CRDBXMLExternal.jar
> C:\CFusionMX\wwwroot\WEB-INF\lib\jsr173_1.0_api.jar
> C:\CFusionMX\wwwroot\WEB-INF\lib\xbean.jar
> C:\CFusionMX\wwwroot\WEB-INF\lib\pullparser.jar
> C:\CFusionMX\wwwroot\WEB-INF\lib\xercesImpl.jar
> C:\CFusionMX\wwwroot\WEB-INF\lib\xml-apis.jar
> C:\CFusionMX\wwwroot\WEB-INF\lib\commons-httpclient.jar
> C:\CFusionMX\wwwroot\WEB-INF\lib\commons-codec.jar
> C:\CFusionMX\wwwroot\WEB-INF\lib\ebus405.jar C:\CFusionMX\wwwroot
>
> etc etc etc.
>
> I assume the error occurs because the .jar file is not in the correct spot?
>
> Can anyone advise?
>
> ( PS, trying get to run Crystal reports to run via java\jsp calls)
>
> Thanks heaps.
>
>
>
>
>
> Scott Thornton, Programmer
> Billing Unit
> Hunter-New England Area Health Service
> ext: 24505 p: +61 02 4941 4505 m: 0413 800 242
>
>
>
> >
>
--
E: [EMAIL PROTECTED]
W: www.compoundtheory.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"cfaussie" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cfaussie?hl=en
-~----------~----~----~----~------~----~------~--~---