Use eclipse to display the Crystal Report on JSP (5) viewer tag Application

Source: Internet
Author: User
Tags tld
I. Completely silly
  1. Add a reference pointing to the viewer tag library descriptor file to the top of the JSP page. At the same time, make sure that the corresponding jar files and additional support files exist.

    <% @ Taglib uri = "/Crystal -T AGS -R Eportviewer. TLD "prefix =" crviewer "%>Note:You can specify any name for the prefix attribute. Prefix: Determine the tag prefix used to access the tag of the tag library.

  2. Create a start viewer tag. In this tag, specify the viewer name and report source type.

    <Crviewer: viewer viewername = "crystalviewer" reportsourcetype = "reportingcomponent">

  3. Create the required report tag.

    This tag specifies the report to be displayed and the session variable to be used to cache the report source.

    <Crviewer: Report reportname = "/reports/sample. rpt"/>

  4. End the viewer tag. The JSP page can now be viewedsample.rpt.

</Crviewer: viewer>

Ii. Custom report source

1. Add a reference pointing to the viewer tag library descriptor file to the top of the JSP page. At the same time, make sure that the corresponding jar files and additional support files exist.

<% @ Import = "com. crystaldecisions. Reports. SDK. reportclientdocument">

<% @ Taglib uri = "/Crystal -T AGS -R Eportviewer. TLD "prefix =" crviewer "%>

Note:You can specify any name for the prefix attribute. Prefix: Determine the tag prefix used to access the tag of the tag library.

2. Create a report source, set the properties of the report source, and cache the report source in the session variable (required)

<%
Final string reportname = "Rpt/sample. rpt ";
Reportclientdocument crdoc = new reportclientdocument ();
Crdoc. Open (reportname, 0 );
Crdoc. getdatabasecontroller (). Logon ("sa ","");
Session. setattribute ("reportsource", crdoc. getreportsource ());
%>

Note: If the default value of the reportsourcevar attribute marked by viewer is crystalreportsource, you do not need to set reportsourcevar if you use this parameter as the session variable name.

3. Create a start viewer tag. In this tag, specify the viewer name and report source type.

<Crviewer: viewer viewername = "crystalviewer" reportsourcetype = "pageserver" reportsourcevar = "reportsource">

4. End the viewer tag. On the JSP page, you can view the report named sample.

</Crviewer: viewer>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.