Birt集成Web项目

1.下载官方的birt-runtime包,解压

2.将jrun.web.xml,server-config.wsdd,viewer.properties拷贝到项目指定目录下.

技术分享

3.将runtime包中web.xml代码复制到web项目中的web.xml中

技术分享
  1 <!-- Default locale setting.
  2     -->
  3     <context-param>
  4         <param-name>BIRT_VIEWER_LOCALE</param-name>
  5         <param-value>en-US</param-value>
  6     </context-param>
  7 
  8     <!-- 
  9         Default timezone setting.
 10         Examples: "Europe/Paris", "GMT+1".
 11         Defaults to the container‘s timezone.        
 12      -->
 13     <context-param>
 14         <param-name>BIRT_VIEWER_TIMEZONE</param-name>
 15         <param-value></param-value>
 16     </context-param>
 17     
 18     <!--
 19         Report resources directory for preview. Defaults to ${birt home}
 20     -->
 21     <context-param>
 22         <param-name>BIRT_VIEWER_WORKING_FOLDER</param-name>
 23         <param-value></param-value>
 24     </context-param>
 25     
 26     <!--
 27         Temporary document files directory. Defaults to ${birt home}/documents
 28     -->
 29     <context-param>
 30         <param-name>BIRT_VIEWER_DOCUMENT_FOLDER</param-name>
 31         <param-value></param-value>
 32     </context-param>
 33 
 34     <!--
 35         Flag whether the report resources can only be accessed under the
 36         working folder. Defaults to true
 37     -->
 38     <context-param>
 39         <param-name>WORKING_FOLDER_ACCESS_ONLY</param-name>
 40         <param-value>true</param-value>
 41     </context-param>
 42 
 43     <!--
 44         Settings for how to deal with the url report path. e.g. "http://host/repo/test.rptdesign". 
 45         
 46         Following values are supported:
 47         
 48         <all>         - All paths.
 49         <domain>    - Only the paths with host matches current domain. Note the comparison is literal, "127.0.0.1" and "localhost" are considered as different hosts.
 50         <none>         - URL paths are not supported.
 51         
 52         Defaults to "domain".
 53     -->
 54     <context-param>
 55         <param-name>URL_REPORT_PATH_POLICY</param-name>
 56         <param-value>domain</param-value>
 57     </context-param>
 58 
 59     <!--
 60         Temporary image/chart directory. Defaults to ${birt home}/report/images
 61     -->
 62     <context-param>
 63         <param-name>BIRT_VIEWER_IMAGE_DIR</param-name>
 64         <param-value></param-value>
 65     </context-param>
 66 
 67     <!-- Engine log directory. Defaults to ${birt home}/logs -->
 68     <context-param>
 69         <param-name>BIRT_VIEWER_LOG_DIR</param-name>
 70         <param-value></param-value>
 71     </context-param>
 72 
 73     <!-- Report engine log level -->
 74     <context-param>
 75         <param-name>BIRT_VIEWER_LOG_LEVEL</param-name>
 76         <param-value>WARNING</param-value>
 77     </context-param>
 78 
 79     <!--
 80         Directory where to store all the birt report script libraries (JARs).
 81         Defaults to ${birt home}/scriptlib
 82     -->
 83     <context-param>
 84         <param-name>BIRT_VIEWER_SCRIPTLIB_DIR</param-name>
 85         <param-value></param-value>
 86     </context-param>
 87     
 88     <!-- Resource location directory. Defaults to ${birt home} -->
 89     <context-param>
 90         <param-name>BIRT_RESOURCE_PATH</param-name>
 91         <param-value></param-value>
 92     </context-param>
 93 
 94     <!-- Preview report rows limit. An empty value means no limit. -->
 95     <context-param>
 96         <param-name>BIRT_VIEWER_MAX_ROWS</param-name>
 97         <param-value></param-value>
 98     </context-param>
 99 
100     <!--
101         Max cube fetch levels limit for report preview (Only used when
102         previewing a report design file using the preview pattern)
103     -->
104     <context-param>
105         <param-name>BIRT_VIEWER_MAX_CUBE_ROWLEVELS</param-name>
106         <param-value></param-value>
107     </context-param>
108     <context-param>
109         <param-name>BIRT_VIEWER_MAX_CUBE_COLUMNLEVELS</param-name>
110         <param-value></param-value>
111     </context-param>
112 
113     <!-- Memory size in MB for creating a cube. -->
114     <context-param>
115         <param-name>BIRT_VIEWER_CUBE_MEMORY_SIZE</param-name>
116         <param-value></param-value>
117     </context-param>
118 
119     <!-- Defines the BIRT viewer configuration file -->
120     <context-param>
121         <param-name>BIRT_VIEWER_CONFIG_FILE</param-name>
122         <param-value>WEB-INF/viewer.properties</param-value>
123     </context-param>
124 
125     <!--
126         Flag whether to allow server-side printing. Possible values are "ON"
127         and "OFF". Defaults to "ON".
128     -->
129     <context-param>
130         <param-name>BIRT_VIEWER_PRINT_SERVERSIDE</param-name>
131         <param-value>ON</param-value>
132     </context-param>
133 
134     <!--
135         Flag whether to force browser-optimized HTML output. Defaults to true
136     -->
137     <context-param>
138         <param-name>HTML_ENABLE_AGENTSTYLE_ENGINE</param-name>
139         <param-value>true</param-value>
140     </context-param>
141 
142     <!--
143         Filename generator class/factory to use for the exported reports.
144     -->
145     <context-param>
146         <param-name>BIRT_FILENAME_GENERATOR_CLASS</param-name>
147         <param-value>org.eclipse.birt.report.utility.filename.DefaultFilenameGenerator</param-value>
148     </context-param>
149 
150     <!--
151         Viewer Filter used to set the request character encoding to UTF-8.
152     -->
153     <filter>
154         <filter-name>ViewerFilter</filter-name>
155         <filter-class>org.eclipse.birt.report.filter.ViewerFilter</filter-class>
156     </filter>
157     <filter-mapping>
158         <filter-name>ViewerFilter</filter-name>
159         <servlet-name>ViewerServlet</servlet-name>
160     </filter-mapping>
161     <filter-mapping>
162         <filter-name>ViewerFilter</filter-name>
163         <servlet-name>EngineServlet</servlet-name>
164     </filter-mapping>
165                     
166     <!-- Viewer Servlet Context Listener -->
167     <listener>
168         <listener-class>org.eclipse.birt.report.listener.ViewerServletContextListener</listener-class>
169     </listener>
170 
171     <!-- Viewer HttpSession Listener -->
172     <listener>
173         <listener-class>org.eclipse.birt.report.listener.ViewerHttpSessionListener</listener-class>
174     </listener>
175     
176     <!-- Viewer Servlet, Supports SOAP -->
177     <servlet>
178         <servlet-name>ViewerServlet</servlet-name>
179         <servlet-class>org.eclipse.birt.report.servlet.ViewerServlet</servlet-class>
180     </servlet>
181 
182     <!-- Engine Servlet -->
183     <servlet>
184         <servlet-name>EngineServlet</servlet-name>
185         <servlet-class>org.eclipse.birt.report.servlet.BirtEngineServlet</servlet-class>
186     </servlet>
187 
188     <servlet-mapping>
189         <servlet-name>ViewerServlet</servlet-name>
190         <url-pattern>/frameset</url-pattern>
191     </servlet-mapping>
192     
193     <servlet-mapping>
194         <servlet-name>ViewerServlet</servlet-name>
195         <url-pattern>/run</url-pattern>
196     </servlet-mapping>
197     
198     <servlet-mapping>
199         <servlet-name>EngineServlet</servlet-name>
200         <url-pattern>/preview</url-pattern>
201     </servlet-mapping>
202 
203     <servlet-mapping>
204         <servlet-name>EngineServlet</servlet-name>
205         <url-pattern>/download</url-pattern>
206     </servlet-mapping>
207 
208     <servlet-mapping>
209         <servlet-name>EngineServlet</servlet-name>
210         <url-pattern>/parameter</url-pattern>
211     </servlet-mapping>    
212 
213     <servlet-mapping>
214         <servlet-name>EngineServlet</servlet-name>
215         <url-pattern>/document</url-pattern>
216     </servlet-mapping>    
217 
218     <servlet-mapping>
219         <servlet-name>EngineServlet</servlet-name>
220         <url-pattern>/output</url-pattern>
221     </servlet-mapping>    
222     
223     <servlet-mapping>
224         <servlet-name>EngineServlet</servlet-name>
225         <url-pattern>/extract</url-pattern>
226     </servlet-mapping>
227 
228     <jsp-config>
229         <taglib>
230             <taglib-uri>/birt.tld</taglib-uri>
231             <taglib-location>/WEB-INF/tlds/birt.tld</taglib-location>
232         </taglib>
233     </jsp-config>        
Web.xml部分代码

4.将birt标签库的包拷贝到指定目录

技术分享

5. 将jar包拷贝到lib目录下!有兴趣的可以自己精简一下。

6.将runtime包中的webcontent目录整个拷贝到指定目录

技术分享

7.启动tomcat,测试运行(test.rptdesign是runtime包中自带的测试报表文件)

技术分享

成功OK!(以上步骤无先后顺序)

文章来自:http://www.cnblogs.com/wuxinyu/p/4218788.html
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3