(三)birt,手动嵌入并发布

1、下载BirtRunningTime      百度网盘:http://pan.baidu.com/s/1jGBV1C6

2、解压BirtRuntime.zip文件

3、新建 web工程,下一步-->下一步-->将Content directory 的名称改为WebRoot(默认为WebContent)

(三)birt,手动嵌入并发布

3、把解压后文件夹中BirtRuntime目录下的webcontentscriptlibreportlogsdocuments文件夹及

index.jsp 、CancelTask.jsp页面放入web工程的WebRoot目录下

4、 把解压后文件夹中BirtRuntime\WEB-INF目录下的tldsattachmentslib文件夹及web-template.xmlweblogic.xmlviewer.propertiesserver-config.wsddjrun.web.xmljboss-web.xml

放入web工程的WebRoot\WEB-INF目录下

4、把解压后文件夹中BirtRuntime\WEB-INF目录下的web.xml中的内容(除版本标签、<web-app>、<display-name>)拷贝至本地web.xml中

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
	<display-name>TEST</display-name>
	<welcome-file-list>

		<welcome-file>index.jsp</welcome-file>
		<welcome-file>default.html</welcome-file>
		<welcome-file>default.htm</welcome-file>
		<welcome-file>default.jsp</welcome-file>
	</welcome-file-list>
	<context-param>
		<param-name>BIRT_VIEWER_LOCALE</param-name>
		<param-value>en-US</param-value>
	</context-param>

	<!-- 
		Default timezone setting.
		Examples: "Europe/Paris", "GMT+1".
		Defaults to the container's timezone.		
	 -->
	<context-param>
		<param-name>BIRT_VIEWER_TIMEZONE</param-name>
		<param-value></param-value>
	</context-param>
	
	<!--
		Report resources directory for preview. Defaults to ${birt home}
	-->
	<context-param>
		<param-name>BIRT_VIEWER_WORKING_FOLDER</param-name>
		<param-value></param-value>
	</context-param>
	
	<!--
		Temporary document files directory. Defaults to ${birt home}/documents
	-->
	<context-param>
		<param-name>BIRT_VIEWER_DOCUMENT_FOLDER</param-name>
		<param-value>D:\eclipse\workspace\TEST\WebRoot\report</param-value>
	</context-param>

	<!--
		Flag whether the report resources can only be accessed 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. e.g. "http://host/repo/test.rptdesign". 
		
		Following values are supported:
		
		<all> 		- All paths.
		<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.
		<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>

	<!--
		Temporary image/chart directory. Defaults to ${birt home}/report/images
	-->
	<context-param>
		<param-name>BIRT_VIEWER_IMAGE_DIR</param-name>
		<param-value></param-value>
	</context-param>

	<!-- Engine log directory. Defaults to ${birt home}/logs -->
	<context-param>
		<param-name>BIRT_VIEWER_LOG_DIR</param-name>
		<param-value></param-value>
	</context-param>

	<!-- Report engine log level -->
	<context-param>
		<param-name>BIRT_VIEWER_LOG_LEVEL</param-name>
		<param-value>WARNING</param-value>
	</context-param>

	<!--
		Directory where to store all the birt report script libraries (JARs).
		Defaults to ${birt home}/scriptlib
	-->
	<context-param>
		<param-name>BIRT_VIEWER_SCRIPTLIB_DIR</param-name>
		<param-value></param-value>
	</context-param>
	
	<!-- Resource location directory. Defaults to ${birt home} -->
	<context-param>
		<param-name>BIRT_RESOURCE_PATH</param-name>
		<param-value></param-value>
	</context-param>

	<!-- Preview report rows limit. An empty value means no limit. -->
	<context-param>
		<param-name>BIRT_VIEWER_MAX_ROWS</param-name>
		<param-value></param-value>
	</context-param>

	<!--
		Max cube fetch levels limit for report preview (Only used when
		previewing a report design file using the preview pattern)
	-->
	<context-param>
		<param-name>BIRT_VIEWER_MAX_CUBE_ROWLEVELS</param-name>
		<param-value></param-value>
	</context-param>
	<context-param>
		<param-name>BIRT_VIEWER_MAX_CUBE_COLUMNLEVELS</param-name>
		<param-value></param-value>
	</context-param>

	<!-- Memory size in MB for creating a cube. -->
	<context-param>
		<param-name>BIRT_VIEWER_CUBE_MEMORY_SIZE</param-name>
		<param-value></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>

	<jsp-config>
		<taglib>
			<taglib-uri>/birt.tld</taglib-uri>
			<taglib-location>/WEB-INF/tlds/birt.tld</taglib-location>
		</taglib>
	</jsp-config>		

</web-app>

 其中:

<context-param>

<param-name>BIRT_VIEWER_DOCUMENT_FOLDER</param-name>

<param-value></param-value><标签中填写报表文件 XXX.rptdesign 的存放的目录-->

</context-param>

****本文将报表文件复制到web工程  WebRoot/report文件夹中,建议放于此处方便管理

5、WebRoot\WEB-INF\lib目录下的所有.jar包引入到web工程中。

6、打开index.jsp 将路径替换为本地报表路径

<p><a href="<%= request.getContextPath( ) + "/preview?__report=/report/XXXX.rptdesign&sample=my+parameter" %>">View Example</a>

7、运行web项目,查看报表


你可能感兴趣的:((三)birt,手动嵌入并发布)