在现有的webapp中集成BIRT

Aci*_*ier 6 java tomcat birt

我想将BIRT报告引擎添加到Tomcat中的现有webapp.我不需要BIRT查看器,我真的只希望能够从URL中运行报告http://localhost:8080/birt/output?__report=test.rptdesign&sample=my+parameter并使用不同的导出选项pdf,xls,doc,html.

到目前为止,我发现的集成指南都包括查看器和编写自己的servlet来处理不同的格式.

我希望有人知道我需要的报告引擎web.xml文件中的哪些servlet映射,以及我需要从现有webapp中的这个准系统BIRT实现的lib目录中包含哪些jar.

Aci*_*ier 17

我希望有人知道我需要的报告引擎web.xml文件中的哪些servlet映射,以及我需要从现有webapp中的这个准系统BIRT实现的lib目录中包含哪些jar.

我不一定想编写自己的servlet我只是想将现有的报告运行时从它自己的独立webapp( "运行时"按钮下)集成到我现有的webapp中,这样我就不必分发2个webapps了.支持运行BIRT报告.对不起,如果那不清楚.

我确实以最简单的方式解决了这个问题,以防任何人有类似的问题(使用BIRT运行时3.7.1):

  1. 您只需要将以下servlet映射添加到您自己的webapp\web-inf\web.xml文件中:

    <!-- Engine Servlet -->
    <servlet>
        <servlet-name>EngineServlet</servlet-name>
        <servlet-class>org.eclipse.birt.report.servlet.BirtEngineServlet</servlet-class>
    </servlet>
    
    <servlet-mapping>
        <servlet-name>EngineServlet</servlet-name>
        <url-pattern>/output</url-pattern>
    </servlet-mapping>
    
    Run Code Online (Sandbox Code Playgroud)
  2. 运行时目录中的所有 jar 包含到您自己的目录中.web-inf\libwebapp\web-inf\lib

然后,您可以使用output来自您自己的webapp 的BIRT报告URL 运行.rptdesign文件,并指定您想要的任何格式,例如:

http://localhost:8080/myOwnWebapp/output?__report=test.rptdesign&__format=pdf
http://localhost:8080/myOwnWebapp/output?__report=test.rptdesign&__format=html
http://localhost:8080/myOwnWebapp/output?__report=test.rptdesign&__format=xls
http://localhost:8080/myOwnWebapp/output?__report=test.rptdesign&__format=doc
http://localhost:8080/myOwnWebapp/output?__report=test.rptdesign&__format=ppt
Run Code Online (Sandbox Code Playgroud)

  • 神奇的答案,Stack Overflow的功劳.完整而准确的要求.干得漂亮. (3认同)