随笔-0  评论-3  文章-28  trackbacks-0
一. 完全傻瓜式
  1. 将一个指向查看器标记库描述符文件的引用添加到 JSP 页面的顶部。 同时必须确保相应的 JAR 文件和附加支持文件都存在。

    <%@ taglib uri="/crystal-tags-reportviewer.tld" prefix="crviewer" %>注意:    可以为 prefix 属性指定任何名称。prefix 确定要使用什么标记前缀来访问标记库的标记。

  2. 创建一个开始 viewer 标记。 在此标记中,指定查看器名称和报表源的类型。

    <crviewer:viewer viewerName="CrystalViewer" reportSourceType="reportingComponent" >

  3. 创建必需的 report 标记。

    此标记指定要显示的报表以及要用于缓存报表源的会话变量。

    <crviewer:report reportName="/reports/sample.rpt"/>

  4. 结束 viewer 标记。 JSP 页面现在即可查看名为 sample.rpt 的报表。

              </crviewer:viewer>

二. 自定义报表源式

       1.    将一个指向查看器标记库描述符文件的引用添加到 JSP 页面的顶部。 同时必须确保相应的 JAR 文件和附加支持文件都存在。

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

          <%@ taglib uri="/crystal-tags-reportviewer.tld" prefix="crviewer" %>

         注意:    可以为 prefix 属性指定任何名称。prefix 确定要使用什么标记前缀来访问标记库的标记。

        2.   创建报表源,设置报表源的属性,把报表源缓存于session变量中(必需的)

            <%
                 final String reportName="rpt/Sample.rpt";
                 ReportClientDocument crDoc = new ReportClientDocument();
                 crDoc.open(reportName,0);
                 crDoc.getDatabaseController().logon("sa","");
                 session.setAttribute("reportSource",crDoc.getReportSource());
           %>

           注意:如果viewer标记的reportSourceVar属性的默认值是crystalReportSource,如果用这个做session变量的名称,那可以不用设置reportSourceVar。

       3.    创建一个开始 viewer 标记。 在此标记中,指定查看器名称和报表源的类型。

             <crviewer:viewer viewerName="CrystalViewer" reportSourceType="pageServer" reportSourceVar="reportSource">

        4.   结束 viewer 标记。 JSP 页面现在即可查看名为 Sample的报表。

            </crviewer:viewer>

posted on 2008-03-28 16:49 阅读(318) 评论(0)  编辑  收藏 所属分类: java基础

只有注册用户登录后才能发表评论。


网站导航: