Example 1 - View a Report with the DHTML Viewer

The following example is a simple JSP page that demonstrates how to use the DHTML report page viewer to display a simple report.

Note:    The report used in this example is not included with the tutorials.

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.businessobjects.com/
Support services
http://www.businessobjects.com/services/support/