此实例说明如何使用查看器标记库来显示使用从受管理报表应用程序服务器中所获得报表源的报表。
<%@ taglib uri="/crystal
<%@ page import="com.crystaldecisions.sdk.exception.SDKException" %>
<%@ page import="com.crystaldecisions.sdk.framework.ISessionMgr" %>
<%@ page import="com.crystaldecisions.sdk.framework.IEnterpriseSession" %>
<%@ page import="com.crystaldecisions.sdk.framework.CrystalEnterprise" %>
<%@ page import="com.crystaldecisions.sdk.occa.managedreports.*" %>
<%@ page import="com.crystaldecisions.sdk.occa.infostore.IInfoObject" %>
<%@ page import="com.crystaldecisions.sdk.occa.infostore.IInfoObjects" %>
<%@ page import="com.crystaldecisions.sdk.occa.infostore.IInfoStore" %>
<%@ page import="com.crystaldecisions.sdk.occa.report.reportsource.IReportSourceFactory2" %>
在本例中,使用了默认管理员帐户来登录到与应用程序服务器运行在同一计算机上的 Crystal Enterprise 安装。
IEnterpriseSession es = CrystalEnterprise.getSessionMgr().logon("administrator", "", "localhost", "secEnterprise");
IInfoStore infoStore = (IInfoStore) es.getService("", "InfoStore");
IInfoObjects infoObjects = infoStore.query("SELECT * FROM CI_INFOOBJECTS WHERE SI_NAME='World Sales Report'");
IInfoObject report = (IInfoObject) infoObjects.get(0);
IReportSourceFactory2 reportFactory = (IReportSourceFactory2) es.getService ("", "RASReportFactory");
Object reportSource = reportFactory.createReportSource(report, request.getLocale());
session.setAttribute("ReportSource", reportSource);
在本例中,报表源类型为 reportApplicationServer,并且报表源变量是指您在其中存储了 ReportSource 对象的会话变量。
<crviewer:viewer viewerName="CrystalViewer" reportSourceType="reportApplicationServer" reportSourceVar="ReportSource" />
Business Objects http://www.china.businessobjects.com 支持服务 http://www.china.businessobjects.com |