BIRT 百灵 java web项目简单示例

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

第一步:到[url]http://www.eclipse.org/downloads/[/url]下载
[color=red]Eclipse IDE for Java and Report Developers 工具[/color]

第二步:[url]http://archive.eclipse.org/birt/downloads/drops/R-R1-2_3_0-200806191030/birt-wtp-integration-sdk-2_3_0.zip[/url]下载birt wtp插件 并安装
[/quote]
[size=large]开始项目的创建:[/size]
[quote]
1.新建一“web project with birt runtime” 名为ReportWeb
[img]http://dl.iteye.com/upload/picture/pic/68754/bc71b9a2-b1da-332e-9490-dd890d65a411.jpg[/img]
2.如图设置:
[img]http://dl.iteye.com/upload/picture/pic/68760/6f78052e-da24-3e09-8cce-d62c35c00f08.jpg[/img]
3.启动tomcat 服务,
访问网址:http://localhost:8080/ReportWeb/frameset?__report=test1.rptdesign&sample=my+parameter
[img]http://dl.iteye.com/upload/picture/pic/68758/b9b1fb81-3138-37fd-91f4-c29f95789380.jpg[/img]
(此为简单示例)
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
即可通过对应的按钮导出相应的格式
[img]http://dl.iteye.com/upload/picture/pic/68756/43a686ec-dea7-338c-b883-3e4ed872cb74.jpg[/img]
[/quote]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值