`
lpzhouyang
  • 浏览: 35130 次
  • 性别: Icon_minigender_1
  • 来自: 昆明
社区版块
存档分类
最新评论

Using the BIRT Web Project Wizard

    博客分类:
  • Birt
阅读更多
转载地址:http://www.newsletterarchive.org/2007/12/06/277634-Using+the+BIRT+Web+Project+Wizard
今天看到一遍很不错的Birt Web Project文章,就转载过来和大家分享了。
Now that you have created your great looking BIRT reports, you need to deploy the design files to make them available to others. There are several different ways to deploy your BIRT report designs. These range from writing all the deployment code from scratch using the Report Engine APIs to writing no code at all with some of the commercial report servers. Somewhere in the middle, there is another option called the Web Viewer Example that will get you off to a nice start. This article will talk about the Web Viewer Example that ships with the Eclipse BIRT Runtime and introduce the BIRT Web Project Wizard that helps you integrate the Web Viewer and BIRT JSP tag library into a web application.

Introduction to BIRT
First, a little bit of information about BIRT. BIRT is a flexible, 100% pure Java reporting tool for building and publishing reports against data sources including databases, XML, Java objects, web services, and more. BIRT stands for Business Intelligence Reporting and Tools and is an Eclipse open source project that benefits from the rich capabilities of the Eclipse platform and a very active community of users. BIRT includes powerful report and chart designers, as well as runtime components for generating and deploying BIRT reports. The BIRT Report Designer provides easy-to-use wizards and point-and-click layout capabilities that are similar to many web page design tools. Finished reports are easily integrated with Java Server Pages, servlets, or existing Java applications and leverage existing application server infrastructure. The rest of this article assumes some level of familiarity with BIRT and will focus on using the BIRT Web Viewer from a BIRT Web Project and using the BIRT JSP tag library.

BIRT Web Project Wizard
To get started using the BIRT Web Project Wizard, you need to be using BIRT 2.2 or higher which can be downloaded here. While in the Eclipse IDE, select File | New | Project, and then select ‘Web Project’ from the ‘Business Intelligence and Report Tools’ section. Press Next and then provide a name for your project and select the Target Runtime for your deployment. I’m selecting Tomcat 5.5 for this example. You can browse and modify the rest of the available settings by selecting Next, or you can accept the defaults by pressing Finish.

Once you are finished, Eclipse will switch to the Java EE perspective so you can work with this type of web project. Locate your project in the Project Explorer and expand the WebContent folder to find index.jsp. Right click on that file and select Run As | Run on Server. Select the server you want to use or define a new server and press Next. Make sure your new BIRT Web Project is listed in the Configured Projects list on the right. Remove any other project that might be in this list and press Next and then press Finish. If everything went as expected, you will see a simple web page (see Figure 1) with a link to a report design example. Select ‘View Example’ to see the report. If you see “Congratulations” then you have successfully run the report.


Figure 1 – Web Viewer Example initial page

Once you have successfully run the example report, you can swap it out with a design of your own. Open index.jsp from the Project Explorer and look for a line near the bottom like the one below:

<a rel="nofollow" href="<%= request.getContextPath( ) + "/frameset?__report=test.rptdesign&sample=my+parameter" %>">View Example</a>

The web viewer is called by using URLs to the frameset servlet mapping and passes parameters specifying which report to run. To run your own report using this method, copy another rptdesign file to your project and replace ‘test.rptdesign’ with the name of your file. Notice that test.rptdesign used a parameter called sample and passed the value of ‘my+parameter’ to the report. Replace that part with your own parameter names and values if desired, or leave the parameters off the URL to use the default values. You can also add ‘__parameterpage=true’ to the URL to force the user to be prompted for the parameters.

If your report depends on external JDBC drivers, you will need to include those prior to running your report. To add your JDBC drivers so the viewer can see them, import your JDBC JAR files into the WEB-INF/platform/plugins/org.eclipse.birt.report.data.oda.jdbc_[version_xxx]/drivers directory. Run index.jsp again and select the View Example URL to run your report. If it was successful, you should see your report.


Figure 2 – Example Report running in the BIRT Web Viewer

BIRT JSP Tag Library
Another option for calling the BIRT Web Viewer from your web project is to use the BIRT JSP Tag Library. There are only 5 base tags (viewer, report, param, parameterPage, and paramDef) and each has several attributes. These JSP tags allow you embed reports or deal with parameters within your JSP page. The rest of this article will show you how to get started with the BIRT JSP tag library and show a few examples of the reports running within a JSP page. I won’t spend much time with the parameter tags as those were explained very well recently in this post from the BIRT World blog.

To get started using the BIRT JSP tag library, right click on WebContent in the BIRT Web Project and select New | Other… Select ‘JSP’ from the ‘Web’ category and then press Next. Provide a name for your JSP page and then press Next. Make sure ‘Use JSP Template’ is selected and then select ‘New JSP File (html,BIRT tag)’ and then press Finish. This JSP Template ensures that the taglib reference below is included.

<%@ taglib uri="/birt.tld" prefix="birt" %>

Once your page is created, you simply need to start typing “<birt…” to see the available tags (See Figure 3).


Figure 3 - BIRT JSP Tag Library

The ‘viewer’ tag allows you to generate and view a BIRT report and includes the Viewer toolbar with the report. The ‘report’ tag is the same as above except it does not include the toolbar. You can see that I used the ‘param’ tag with each to supply the parameter for the report. Output generated is shown in Figure 4. . <birt:viewer id="test1" reportDesign="test.rptdesign" width="600" height="200"> <birt:param name="sample" value="BIRT Rocks!"></birt:param> </birt:viewer>

<birt:report id="test2" reportDesign="test.rptdesign" width="600" height="200"> <birt:param name="sample" value="BIRT Rocks!"></birt:param> </birt:report>


Figure 4 - BIRT JSP Tag Library - 'report' tag and 'viewer' tag examples

If you want to prompt the user for the parameters instead of passing them in, you need to set the ‘showParameterPage’ attribute to ‘true’ like below. This will prompt the user for the parameters and then run the report in the same space allocated by the height and width parameters. (See Figure 5)

<birt:viewer id="test1" reportDesign="test.rptdesign" width="600" height="600" showParameterPage="true"> </birt:viewer>


Figure 5 - BIRT JSP Tag Library - 'viewer' tag using 'showParameterPage' attribute

These steps were intended to get you started with your BIRT Web Project deployment. There is more information available at the URLs below.

分享到:
评论
1 楼 yangzy666 2010-04-23  
老大要是把它翻译过来了,就更好了

相关推荐

    Web Service Proxy Wizard的介绍,安装,以及如何使用

    Web Service Proxy Wizard 是一个工具,它为Visual Studio 6.0的开发者提供了一种方法,可以将Web服务封装成一个代理组件(.dll),这个组件可以在设计时通过早期绑定(Early Binding)像其他COM组件一样使用。...

    西门子_Generating the Parameters for the Modbus TCP Communication using the Modbus TCP Wizard.pdf

    以上知识点全面总结了西门子Modbus TCP Wizard应用程序的使用方法和注意事项,用户可以根据这些知识快速配置Modbus TCP通信,并在必要时寻求技术支持。此外,文档还强调了在使用工业自动化软件和工具时,用户应负有...

    Web Page Wizard-开源

    Web Page Wizard是一个开源项目,旨在为Web托管服务器提供一套CGI脚本和Perl模块,以帮助客户端轻松管理和创建他们的网页。这个工具集的功能类似于著名的Geocities.com提供的服务,让用户能够通过浏览器界面进行一...

    kotlin-project-wizard-idea.jar

    kotlin-project-wizard-idea.jar

    exe4j Wizard.zip

    《exe4j Wizard.zip——将Java程序转化为可执行exe文件的解决方案》 在软件开发领域,尤其是Java开发者中,常常需要将编写的Java应用程序转换为Windows操作系统下的可执行exe文件,以便非Java环境的用户也能方便地...

    was开发环境搭建步骤

    - 选择“Checkout as a project configured using the New Project Wizard”,点击下一步。 - 选择“EJB Project”,点击“Next”。 - 定义项目名称为“iTreasuryEJB”。 ##### 2. 新建iTreasuryWEB - 在SVN ...

    WebWizard-开源

    WebWizard是一个用Visual Basic.NET 2005编写的Web浏览器项目。尽管它仍处于Alpha状态且存在一些错误,但它已经成为半个体面的浏览器。 但是,存在一个导致其崩溃的错误。 你能帮我解决吗?

    MyEclipse_Web_Project_Quickstart.pdf

    ### MyEclipse Web Project Quickstart知识点详述 #### 一、前言 本文档主要针对使用Sun JDK 1.4.2、Eclipse 3.1以及MyEclipse 4.0版本进行编写的用户。所有截图均采用Eclipse、MyEclipse及Windows XP默认设置下的...

    用Tomcat 和Eclipse开发Web 应用程序(部署发布)配置.docx

    然后,从列表中选择 Dynamic Web Project,使用 Standard Web Project Wizard 来建立静态 HTML Web 项目。 配置 Tomcat 服务器 在 Target Runtime 下,选择 Apache Tomcat V5.5,并单击 New 打开 New Target ...

    Application Web Update Wizard-开源

    "Application Web Update Wizard-开源"项目正是一套专为开发者设计的框架,它简化了在服务器端发布更新流程,同时也让用户能够通过Web Update Wizard应用程序方便地下载和安装这些更新。这个开源项目的核心价值在于...

    c# winform 向导 Wizard

    "c# winform 向导 Wizard"是WinForm应用程序中实现多步骤交互流程的一种设计模式,常用于引导用户逐步完成复杂任务或设置。在本篇中,我们将深入探讨如何创建和使用自定义的Wizard控件,以及它在软件中的应用价值。 ...

    SmartWizard

    "SmartWizard"是一款高度可定制且界面美观的表单向导插件,它基于流行的JavaScript库jQuery构建。这款插件专为帮助用户创建引人入胜、交互性强的多步骤表单体验而设计。在本篇文章中,我们将深入探讨SmartWizard的...

    LP Wizard安装文件

    LP Wizard是一款专业的封装计算软件,尤其在电子设计领域中,它以其高效和精确性而备受赞誉。该软件的核心功能是帮助工程师们根据IPC-7351标准进行元器件的封装设计,确保了电子产品的可靠性与性能。IPC-7351是一种...

    MyEclipse+xFire开发Web Service

    通过理解xFire的基本概念和MyEclipse的Web Services Project Wizard的使用方法,开发者可以轻松地搭建起Web服务的基础架构,进一步实现复杂的服务交互和集成。这个教程为初学者提供了一个良好的起点,让他们能够进入...

    lpWizard_10_5安装包

    "lpWizard_10_5安装包"是一个用于配置和管理打印机的工具,主要服务于Linux系统,尽管"LPWizard"这个名字可能让人误以为是与Windows操作系统相关,实际上它与Linux打印系统(LPD,Line Printer Daemon)紧密相连。...

    Chameleon Wizard-v4.4.1

    "Chameleon Wizard-v4.4.1" 是一个软件版本标识,这通常指的是某个应用程序或工具的特定更新迭代。在IT行业中,版本号的提升往往意味着软件修复了之前的问题,增加了新功能,或者提升了性能。"v4.4.1" 这样的格式...

Global site tag (gtag.js) - Google Analytics