Using the BIRT Web Project Wizard

本文介绍了如何使用BIRT Web Project Wizard快速部署BIRT报表设计文件,并通过Web Viewer Example进行查看。此外,还讲解了如何利用BIRT JSP Tag Library在JSP页面中嵌入报表。
转载地址:[url]http://www.newsletterarchive.org/2007/12/06/277634-Using+the+BIRT+Web+Project+Wizard[/url]
今天看到一遍很不错的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.
内容概要:本文介绍了一个基于多传感器融合的定位系统设计方案,采用GPS、里程计和电子罗盘作为定位传感器,利用扩展卡尔曼滤波(EKF)算法对多源传感器数据进行融合处理,最终输出目标的滤波后位置信息,并提供了完整的Matlab代码实现。该方法有效提升了定位精度与稳定性,尤其适用于存在单一传感器误差或信号丢失的复杂环境,如自动驾驶、移动采用GPS、里程计和电子罗盘作为定位传感器,EKF作为多传感器的融合算法,最终输出目标的滤波位置(Matlab代码实现)机器人导航等领域。文中详细阐述了各传感器的数据建模方式、状态转移与观测方程构建,以及EKF算法的具体实现步骤,具有较强的工程实践价值。; 适合人群:具备一定Matlab编程基础,熟悉传感器原理和滤波算法的高校研究生、科研人员及从事自动驾驶、机器人导航等相关领域的工程技术人员。; 使用场景及目标:①学习和掌握多传感器融合的基本理论与实现方法;②应用于移动机器人、无人车、无人机等系统的高精度定位与导航开发;③作为EKF算法在实际工程中应用的教学案例或项目参考; 阅读建议:建议读者结合Matlab代码逐行理解算法实现过程,重点关注状态预测与观测更新模块的设计逻辑,可尝试引入真实传感器数据或仿真噪声环境以验证算法鲁棒性,并进一步拓展至UKF、PF等更高级滤波算法的研究与对比。
PlatformIO 是一个跨平台的开发环境,支持多种嵌入式平台和开发板。通过其内置的 Project Wizard 功能,用户可以快速创建和配置项目结构,选择目标开发板,并设置构建环境。Project Wizard 提供了直观的交互式流程,简化了项目的初始化过程。 使用 Project Wizard 创建项目时,PlatformIO 会根据用户的选择自动生成项目文件和目录结构,包括 `src` 目录(用于存放源代码)、`include` 目录(用于存放头文件)、`lib` 目录(用于存放第三方库)以及 `platformio.ini` 配置文件。`platformio.ini` 是 PlatformIO 项目的核心配置文件,它定义了开发板型号、平台版本、构建选项、上传设置等关键参数[^1]。 Project Wizard 还支持从模板创建项目,例如基于特定开发板的空白项目模板、示例代码模板或特定框架的项目模板。这种灵活性使得开发者可以快速启动项目,而不必手动配置复杂的构建系统。此外,Project Wizard 允许用户选择不同的框架和库,例如 Arduino、ESP-IDF、Zephyr 等,从而满足不同项目的需求[^1]。 以下是一个典型的 `platformio.ini` 配置示例,展示了如何配置一个基于 ESP32 开发板的项目: ```ini [env:esp32dev] platform = espressif32 board = esp32dev framework = arduino ``` 在该配置中: - `platform` 指定了目标平台为 `espressif32`,即 ESP32 系列芯片。 - `board` 定义了使用的开发板型号为 `esp32dev`,这是 ESP32 的通用开发板。 - `framework` 设置了使用的开发框架为 `arduino`,表示该项目将使用 Arduino 框架进行开发[^1]。 通过 Project Wizard 创建项目后,用户可以使用 PlatformIO 的命令行工具或集成开发环境(如 VS Code 和 Atom)进行编译、上传和调试操作。PlatformIO 提供了丰富的命令,例如 `pio run` 用于构建项目,`pio upload` 用于将编译好的固件上传到目标设备,`pio monitor` 用于启动串口监视器以查看设备输出信息[^1]。 此外,Project Wizard 还支持多环境配置,允许用户在一个项目中定义多个构建环境。例如,可以在 `platformio.ini` 文件中定义多个 `[env:...]` 段落,分别对应不同的开发板或构建配置。这样,用户可以在同一个项目中管理多个目标平台或构建变体,而无需为每个目标单独创建项目[^1]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值