javaweb项目与 birt 集成
准备工作(eclipse自己装)--非maven项目,普通的javaweb项目
1,下载birt-runtime-4_2_0.zip包。
链接:https://pan.baidu.com/s/11kiwlw9w77lRg1Pd6E_fjQ
提取码:5gpc
复制这段内容后打开百度网盘手机App,操作更方便哦
2,下载birt-report-framework-4.8.0-20180626.zip 包(具体版本个eclipse 对应即可)
链接:https://pan.baidu.com/s/1OsmC7n7k4FgUgoKYNlcqpw
提取码:m7v6
1,开始集成javaweb 与 birt
(1)创建web项目:
(2)打开birt-runtime-4_2_0包。解压出来:
将birt-runtime-4_2_0\WebViewerExample 下的 logs、report、scriptlib 文件夹 放到javaweb 的 webcontent下。
将birt-runtime-4_2_0\WebViewerExample\WEB-INF\lib 下的jar包 添加到 javaweb项目中WEB-INF\lib下
将birt-runtime-4_2_0\WebViewerExample\webcontent 复制到 javaweb项目中的 webcontent下
将birt-runtime-4_2_0\WebViewerExample 下的WEB-INF 下的 server-config.wsdd 和 viewer.properties 和 tlds 文件夹 放到 javaweb的 webcontent/WEB-INF下面。
将birt-runtime-4_2_0\WebViewerExample\index.jsp 放到 javaweb 的 webcontent下。
将birt-runtime-4_2_0\WebViewerExample\test.rptdesign 放到 javaweb的 webcontent/report 里面。
注:在javaweb项目的web.xml 添加以下
<!-- Report resources directory for preview. Defaults to ${birt home} -->
<context-param>
<param-name>BIRT_VIEWER_WORKING_FOLDER</param-name>
<param-value>report</param-value>
</context-param>
<!-- Flag whether the report resources can be accessed only
under the working folder. Defaults to true -->
<context-param>
<param-name>WORKING_FOLDER_ACCESS_ONLY</param-name>
<param-value>true</param-value>
</context-param>
<!-- Settings for how to deal with the url report path.
For example, "http://host/repo/test.rptdesign".
Following values are supported:
<all> - All paths.
<domain> - Only the paths with host matches current domain.
The comparison is literal, "127.0.0.1" and "localhost" are
considered as different hosts. <none> - URL paths are not supported.
Defaults to "domain". -->
<context-param>
<param-name>URL_REPORT_PATH_POLICY</param-name>
<param-value>domain</param-value>
</context-param>
<!-- Defines the BIRT viewer configuration file -->
<context-param>
<param-name>BIRT_VIEWER_CONFIG_FILE</param-name>
<param-value>WEB-INF/viewer.properties</param-value>
</context-param>
<!-- Flag whether to allow server-side printing.
Possible values are "ON" and "OFF". Defaults to "ON". -->
<context-param>
<param-name>BIRT_VIEWER_PRINT_SERVERSIDE</param-name>
<param-value>ON</param-value>
</context-param>
<!-- Flag whether to force browser-optimized HTML output. Defaults to true -->
<context-param>
<param-name>HTML_ENABLE_AGENTSTYLE_ENGINE</param-name>
<param-value>true</param-value>
</context-param>
<!-- Filename generator class/factory to use for the exported reports. -->
<context-param>
<param-name>BIRT_FILENAME_GENERATOR_CLASS</param-name>
<param-value>
org.eclipse.birt.report.utility.filename.DefaultFilenameGenerator</param-value>
</context-param>
<!-- Viewer Filter used to set the request character encoding to UTF-8. -->
<filter>
<filter-name>ViewerFilter</filter-name>
<filter-class>org.eclipse.birt.report.filter.ViewerFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>ViewerFilter</filter-name>
<servlet-name>ViewerServlet</servlet-name>
</filter-mapping>
<filter-mapping>
<filter-name>ViewerFilter</filter-name>
<servlet-name>EngineServlet</servlet-name>
</filter-mapping>
<!-- Viewer Servlet Context Listener -->
<listener>
<listener-class>org.eclipse.birt.report.listener.ViewerServletContextListener</listener-class>
</listener>
<!-- Viewer HttpSession Listener -->
<listener>
<listener-class>org.eclipse.birt.report.listener.ViewerHttpSessionListener</listener-class>
</listener>
<!-- Viewer Servlet, Supports SOAP -->
<servlet>
<servlet-name>ViewerServlet</servlet-name>
<servlet-class>org.eclipse.birt.report.servlet.ViewerServlet</servlet-class>
</servlet>
<!-- Engine Servlet -->
<servlet>
<servlet-name>EngineServlet</servlet-name>
<servlet-class>org.eclipse.birt.report.servlet.BirtEngineServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ViewerServlet</servlet-name>
<url-pattern>/frameset</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>ViewerServlet</servlet-name>
<url-pattern>/run</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>EngineServlet</servlet-name>
<url-pattern>/preview</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>EngineServlet</servlet-name>
<url-pattern>/download</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>EngineServlet</servlet-name>
<url-pattern>/parameter</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>EngineServlet</servlet-name>
<url-pattern>/document</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>EngineServlet</servlet-name>
<url-pattern>/output</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>EngineServlet</servlet-name>
<url-pattern>/extract</url-pattern>
</servlet-mapping>
<!-- For Web module version higher than 2.3 -->
<!--
<jsp-config>
<taglib>
<taglib-uri>/birt.tld</taglib-uri>
<taglib-location>/WEB-INF/tlds/birt.tld</taglib-location>
</taglib>
</jsp-config>
-->
<!-- For Web module version 2.3 -->
<jsp-config>
<taglib>
<taglib-uri>
/birt.tld
</taglib-uri>
<taglib-location>
/WEB-INF/tlds/birt.tld
</taglib-location>
</taglib>
</jsp-config>
完成样子:
tomcat 需要自己配置一下,然后启动。启动成功后,访问地址
url:http:/127.0.0.1:8080/birt/frameset?__report=test.rptdesign 或者 http:/127.0.0.1:8080/birt/
出现以下图片,证明就简单集合成功了。
2,集成birt 与 eclipse 的集成,采用的是离线安装
解压birt-report-framework-4.8.0-20180626.zip,解压出来是eclipse。 里面包含plugins、features。
如果发现自己安装的 eclipse 下没有features此文件夹。则将 plugins和 features 复制一份到 eclipse 下的 dropins 文件夹下
如下面:
3,完成后重启eclipse,如果有这个就代表安装成功
这就是集成安装。 --- 其他的操作网上就很多文章讲如何操作了。 我就先不写了。
上一篇: 浅谈百度的一些产品对优化推广起到的作用
下一篇: 蘑菇街等导购站转型自营就能万事大吉吗