以下範例是一個簡單的 JSP 頁面,示範如何使用 DHTML 報表頁面檢視器來顯示簡單的報表。
<%@ 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.taiwan.businessobjects.com/ 支援服務 http://www.businessobjects.com/services/support/ |