这里主要介绍的是部署一个已经存在的BIRT报表。也就是说已经设计好了.reptdesign文件,本文并不介绍如何设计BIRT报表。
Deploying a BIRT report to an application server
这里BIRT目前版本没有在高于JRE1.4的环境中测试过,如果需要发布到JRE1.5的环境中,可能会有问题。以下内容使用TOMCAT为例。
1.Placing the BIRT report viewer on the application server
拷贝ECLIPSE_INSTALL/plugins/org.eclipse.birt.report.viewer_1.0.1/birt到你的$TOMCAT_INSTALL/webapps,这个BIRT其实就是一个完整web应用,不需要再添加什么JAR包了。也可以通过在TOMCAT中指定目录<Context />来添加,具体内容可以查看文档。
2.Viewing a report using a browser
添加完birt的应用后,启动TOMCAT,然后就可以通过浏览器访问BIRT。这里有2种方式:
http://localhost:8080/birt/run?parameter_list
http://localhost:8080/birt/frameset?parameter_list
2.1 Understanding the run servlet
如果使用run servlet,BIRT会显示一个单独的Web页面或者一个PDF文件
2.2 Understanding the frameset servlet
如果使用 frameset servlet,BIRT将会显示3个Frame,一个显示输入报表参数的表单,一个显示报表,一个显示导航条。
2.3 Understanding the URL parameters
下表为servlet可以支持的参数,需要注意的是_frame参数仅对frame servlet有效,reportParam参数是指自己的report中定义的参数。
Parameter Values Required/default
__report path to report design file Yes, no default
__format html or pdf Optional /default to html
__frame true or false Optional /default to true
__locale locale Optional /defaults to JVM locale
__navigation hide or parameter Optional /default to auto
__toolbar true or false Optional /default to true
__isnull any user-defined report parameter values Optional /no default value
reportParam User-defined As specified in the report design / As specified in the
report design
2.3.1 Understanding the __report parameter
__report参数有3种定义方式
a.绝对路径
http://localhost:8080/birt/run?__report=C:\myReport.rptdesign
自己的rptdesin文件存放在C:\myReport.rptdesign
b.相对路径,但是自己的web.xml中没有定义BIRT_VIEWER_REPORT_ROOT
http://localhost:8080/birt/run?__report=Report\myReport.rptdesign
自己的rptdesin文件存放在$TOMCAT_INSTALLl\webapps\birt\Report\myReport.rptdesign
c.相对路径,但是自己的web.xml中定义了BIRT_VIEWER_REPORT_ROOT为C:\Reports
http://localhost:8080/birt/run?__report=myReport.rptdesign
自己的rptdesin文件存放在C:\Reports\myReport.rptdesign
其他的参数都很简单,就不一一介绍了。
部署的过程其实很简单,笔者遇到的问题主要有
1.路径不对
2.自定义参数未定义
3.__locale参数未加,显示中文有问题
4.所有参数前面是两个下划线
本文转自:http://www.eclipseworld.org/bbs/read-cec-tid-1948.html