皕杰报表集成到springboot项目

皕杰报表集成到springboot项目

一、maven构建项目
1、访问http://start.spring.io/
2、选择构建工具Maven Project、Spring Boot版本2.0.5以及一些工程基本信息,点击“Switch to the full version.”java版本选择8,可参考下图所示:
在这里插入图片描述
3、点击Generate Project下载项目压缩包
4、解压后,使用eclipse,Import -> Existing Maven Projects -> Next ->选择解压后的文件夹-> Finsh,OK done!
二、引入web模块
1、pom.xml中添加支持web的模块:

<dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
 </dependency>

pom.xml文件中默认有两个模块:
spring-boot-starter:核心模块,包括自动配置支持、日志和YAML;
spring-boot-starter-test:测试模块,包括JUnit、Hamcrest、Mockito。
2、编写controller内容

@RestController
public class HelloWorldController {
    @RequestMapping("/hello")
    public String index() {
        return "Hello World";
    }
}

@RestController的意思就是controller里面的方法都以json格式输出,不用再写什么jackjson配置的了!
3、启动主程序,打开浏览器访问http://localhost:8080/hello,就可以看到效果了,有木有很简单!
三、皕杰web应用嵌套springboot项目
1、在springboot项目src/main文件夹下创建webapp目录

2、将皕杰报表demoserver/webapps/report下的bios_demo、bios_jsp、bios_web_res、WEB-INF文件夹复制到springboot项目src/main/webapp下

3、更改springboot项目的pom.xml
在节点里添加

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<dependency>  
	<groupId>bijet-license</groupId>  
	<artifactId>bijet-license-sdk</artifactId>  
	<version>1.0</version>  
	<scope>system</scope>  
	<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/bijet-license.jar</systemPath>  
</dependency>
<dependency>  
	<groupId>bios-cos</groupId>  
	<artifactId>bios-cos-sdk</artifactId>  
	<version>1.0</version>  
	<scope>system</scope>  
	<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/bios-cos.jar</systemPath>  
</dependency>
<dependency>  
	<groupId>bios-cos</groupId>  
	<artifactId>bios-cos-sdk</artifactId>  
	<version>1.0</version>  
	<scope>system</scope>  
	<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/bios-cos.jar</systemPath>  
</dependency>
<dependency>  
	<groupId>bios-ehcache-1.6.2</groupId>  
	<artifactId>bios-ehcache-1.6.2-sdk</artifactId>  
	<version>1.0</version>  
	<scope>system</scope>  
	<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/bios-ehcache-1.6.2.jar</systemPath>  
</dependency>
<dependency>  
	<groupId>bios-iText-2.1.7</groupId>  
	<artifactId>bios-iText-2.1.7-sdk</artifactId>  
	<version>1.0</version>  
	<scope>system</scope>  
	<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/bios-iText-2.1.7.jar</systemPath>  
</dependency> 
<dependency>  
	<groupId>bios-poi-3.9</groupId>  
	<artifactId>bios-poi-3.9-sdk</artifactId>  
	<version>1.0</version>  
	<scope>system</scope>  
	<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/bios-poi-3.9.jar</systemPath>  
</dependency>  
<dependency>  
	<groupId>bios-poi-ooxml-3.9</groupId>  
	<artifactId>bios-poi-ooxml-3.9-sdk</artifactId>  
	<version>1.0</version>  
	<scope>system</scope>  
	<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/bios-poi-ooxml-3.9.jar</systemPath>  
</dependency>  
<dependency>  
	<groupId>bios-report</groupId>  
	<artifactId>bios-report-sdk</artifactId>  
	<version>1.0</version>  
	<scope>system</scope>  
	<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/bios-report.jar</systemPath>  
</dependency> 
<dependency>  
	<groupId>dom4j-1.6.1</groupId>  
	<artifactId>dom4j-1.6.1-sdk</artifactId>  
	<version>1.0</version>  
	<scope>system</scope>  
	<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/dom4j-1.6.1.jar</systemPath>  
</dependency> 
<dependency>  
	<groupId>commons-logging-1.0.4</groupId>  
	<artifactId>commons-logging-1.0.4-sdk</artifactId>  
	<version>1.0</version>  
	<scope>system</scope>  
	<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/commons-logging-1.0.4.jar</systemPath>  
</dependency> 
<dependency>  
	<groupId>iTextAsian</groupId>  
	<artifactId>iTextAsian-sdk</artifactId>  
	<version>1.0</version>  
	<scope>system</scope>  
	<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/iTextAsian.jar</systemPath>  
</dependency>
<dependency>  
	<groupId>javax.wsdl_1.5.1.v200806030408</groupId>  
	<artifactId>javax.wsdl_1.5.1.v200806030408-sdk</artifactId>  
	<version>1.0</version>  
	<scope>system</scope>  
	<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/javax.wsdl_1.5.1.v200806030408.jar</systemPath>  
</dependency> 
<dependency>  
	<groupId>javax.xml_1.3.4.v200902170245</groupId>  
	<artifactId>javax.xml_1.3.4.v200902170245-sdk</artifactId>  
	<version>1.0</version>  
	<scope>system</scope>  
	<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/javax.xml_1.3.4.v200902170245.jar</systemPath>  
</dependency> 
<dependency>  
	<groupId>org.apache.xerces_2.9.0.v200909240008</groupId>  
	<artifactId>org.apache.xerces_2.9.0.v200909240008-sdk</artifactId>  
	<version>1.0</version>  
	<scope>system</scope>  
	<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/org.apache.xerces_2.9.0.v200909240008.jar</systemPath>  
</dependency> 
<dependency>  
	<groupId>poi-ooxml-schemas-3.9-20121203</groupId>  
	<artifactId>poi-ooxml-schemas-3.9-20121203-sdk</artifactId>  
	<version>1.0</version>  
	<scope>system</scope>  
	<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/poi-ooxml-schemas-3.9-20121203.jar</systemPath>  
</dependency> 
<dependency>  
	<groupId>stax-api-1.0.1</groupId>  
	<artifactId>stax-api-1.0.1-sdk</artifactId>  
	<version>1.0</version>  
	<scope>system</scope>  
	<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/stax-api-1.0.1.jar</systemPath>  
</dependency> 
<dependency>  
	<groupId>xmlbeans-2.3.0</groupId>  
	<artifactId>xmlbeans-2.3.0-sdk</artifactId>  
	<version>1.0</version>  
	<scope>system</scope>  
	<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/xmlbeans-2.3.0.jar</systemPath>  
</dependency> 
<dependency>  
	<groupId>server</groupId>  
	<artifactId>server-sdk</artifactId>  
	<version>1.0</version>  
	<scope>system</scope>  
	<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/server.jar</systemPath>  
</dependency>

在节点里添加

<resources>
	<resource>
		<directory>src/main/webapp/WEB-INF/resources</directory>
		<includes>
			<include>**/*.properties</include>
			<include>**/*.xml</include>
		</includes>
		<filtering>false</filtering>
	</resource>
</resources>

4、新建reportConfig类配置皕杰报表servlet访问

package com.example.demo;
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.web.servlet.*;
import org.springframework.context.annotation.*;
import bios.report.engine.output.*;
@Configuration 
public class reportConfig {
	@Bean
	public ServletRegistrationBean servletRegistrationBean() {
		ServletRegistrationBean re = new ServletRegistrationBean(new ReportEmitter());
		re.setLoadOnStartup(2);
		re.setName("reportServlet");
		re.addInitParameter("reportConf", "config.xml");
		re.addUrlMappings("/ReportEmitter");
		return re;
	}
	public ServletRegistrationBean servletRegistrationBean1() {
		ServletRegistrationBean re = new ServletRegistrationBean(new ImageServlet());
		re.setName("imageServlet");
		re.addUrlMappings("/ImgServlet");
		return re;
	}
	public ServletRegistrationBean servletRegistrationBean2() {
		ServletRegistrationBean re = new ServletRegistrationBean(new FillinServlet());
		re.setName("fillinServlet");
		re.addUrlMappings("/FillinServlet");
		return re;
	}
}

5、启动springboot项目,访问报表
http://localhost:8080/ReportEmitter?rpt=Demo/图文展现/动态色彩.brt
在这里插入图片描述

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值