`

BIRT 百灵 java web项目简单示例

阅读更多
引用

用eclipse3.6  开发web的birt需要:

第一步:到http://www.eclipse.org/downloads/下载
Eclipse IDE for Java and Report Developers 工具

第二步:http://archive.eclipse.org/birt/downloads/drops/R-R1-2_3_0-200806191030/birt-wtp-integration-sdk-2_3_0.zip下载birt wtp插件 并安装

开始项目的创建:
引用

1.新建一“web project with birt runtime” 名为ReportWeb

2.如图设置:

3.启动tomcat 服务,
访问网址:http://localhost:8080/ReportWeb/frameset?__report=test1.rptdesign&sample=my+parameter

(此为简单示例)
4.在jsp页面引入已经设计好的报表:
   新建一jsp页面在webContent目录下:testreport.jsp,内容如下:
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="birt" uri="/WEB-INF/tlds/birt.tld" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<script type="text/javascript">
			function expDoc() {
				window.open("/ReportWeb/frameset?__report=test1.rptdesign&sample=my+parameter&__masterpage=true&__format=doc");
			}
			function expExcel() {
				window.open("/ReportWeb/frameset?__report=test1.rptdesign&sample=my+parameter&__masterpage=true&__format=xls");
			}
			function expPDF() {
				window.open("/ReportWeb/frameset?__report=test1.rptdesign&sample=my+parameter&__masterpage=true&__format=pdf");
			}
	</script>
<body>
	<birt:report id="0"
				 top="100"
				 left="100"
				 width="800"
				 height="600"
				 reportDesign="test1.rptdesign"
				 position="absolute"
				 format="html">
	
	</birt:report>

	<input type="button" value="保存成word" onclick="javaScript:expDoc();"/>
	<input type="button" value="保存成Excel" onclick="javaScript:expExcel();"/>
	<input type="button" value="保存成PDF" onclick="javaScript:expPDF();"/>

</body>
</html>

5.启动服务,访问地址:http://localhost:8080/ReportWeb/testreport.jsp
即可通过对应的按钮导出相应的格式


分享到:
评论
1 楼 lovertc 2012-06-12  
http://archive.eclipse.org/birt/downloads/drops/R-R1-2_3_0-200806191030/birt-wtp-integration-sdk-2_3_0.zip 下载不到 烦请发一份lzf05303778@163.com

相关推荐

Global site tag (gtag.js) - Google Analytics