示例 1 - 通过 DHTML 查看器查看报表

下例是一个简单的 JSP 页面,它演示了如何使用 DHTML 报表页面查看器来显示简单的报表。

注意:    本例中使用的报表未随附于教程中。

viewreport.jsp

<%@ page import="com.crystaldecisions.report.web.viewer.CrystalReportViewer" %>

<%@ page import="com.crystaldecisions.reports.sdk.ReportClientDocument" %>

<%

    Object reportSource = session.getAttribute("reportSource");

    if (reportSource == null)

    {

        String report = "/reports/sample.rpt";

        ReportClientDocument reportClientDoc = new ReportClientDocument();

        reportClientDoc.open(report, 0);

        reportSource = reportClientDoc.getReportSource();

        session.setAttribute("reportSource", reportSource);

    }

    CrystalReportViewer viewer = new CrystalReportViewer();

    viewer.setReportSource(reportSource);

    viewer.setOwnPage(true);

    viewer.processHttpRequest(request, response, getServletConfig().getServletContext(), null);

%>



Business Objects
http://www.china.businessobjects.com/

支持服务
http://www.china.businessobjects.com/services/services.htm