欢迎光临
我们一直在努力

ureport2二次开发,ureport3

1.在pom.xml中加入

<dependency> <groupId>com.bstek.ureport</groupId> <artifactId>ureport2-console</artifactId> <version>[version]</version></dependency>

2.Repository信息

<repository> <id>sonatype</id> <url>https://oss.sonatype.org/content/groups/public/</url></repository>

3.打开项目的web.xml文件,在其中添加如下所示的servlet配置

<servlet> <servlet-name>ureportServlet</servlet-name> <servlet-class>com.bstek.ureport.console.UReportServlet</servlet-class></servlet><servlet-mapping> <servlet-name>ureportServlet</servlet-name> <url-pattern>/ureport/*</url-pattern></servlet-mapping>

因为UReport2是架构在spring之上的,所以作为配置的最后一步就是让我们的项目加载UReport2的spring配置文件,加载的方法有很多,比如我们可以打开web.xml,在其中添加一个spring提供的listener直接加载UReport2提供的spring配置文件,如下所示:

<listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener><context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:ureport-console-context.xml</param-value></context-param>

如果您的项目中没有采用spring,那么就可以采用上述配置直接加载UReport2提供的spring配置文件,如果您的项目中也用到了spring,或项目中其它模块用到了spring,那么可以在我们已存在的spring配置文件中导入UReport2提供的spring配置文件,如下配置所示:

<import resource=”classpath:ureport-console-context.xml” />

如果项目中没已存在的spring配置文件,那么我们可以在WEB-INF目录下新建一个名为context.xml的spring配置文件,在其中导入UReport2提供的spring配置文件,如下所示:
context.xml文件内容

<?xml version=”1.0″ encoding=”UTF-8″?><beans xmlns=”http://www.springframework.org/schema/beans” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns:context=”http://www.springframework.org/schema/context” xsi:schemaLocation=”http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context 便宜美国vps http://www.springframework.org/schema/context/spring-context-3.0.xsd “> <import resource=”classpath:ureport-console-context.xml” /></beans>

接下来打开web.xml,在其中添加一个spring提供的listener,加载我们新建的这个context.xml文件,如下所示:
listener中加载context.xml文件

<listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener><context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/context.xml</param-value></context-param>

我们就在一个标准的Maven项目中加入了UReport2,运行项目,在浏览器中访问URL:http://localhost:8080/ureport-demo/ureport/designer,就可以看到UReport2的报表设计器界面

赞(0)
【声明】:本博客不参与任何交易,也非中介,仅记录个人感兴趣的主机测评结果和优惠活动,内容均不作直接、间接、法定、约定的保证。访问本博客请务必遵守有关互联网的相关法律、规定与规则。一旦您访问本博客,即表示您已经知晓并接受了此声明通告。