【问题标题】:Error 404 viewing a BIRT Report in a JSP page in Eclipse在 Eclipse 的 JSP 页面中查看 BIRT 报告时出现错误 404
【发布时间】:2020-09-09 01:43:28
【问题描述】:

我正在尝试在 JSP 中运行 BIRT 报告,遵循 The BIRT documentation 几乎一切正常:报告在预览中正确查看,但是当我尝试运行项目并在 JSP 中显示报告时,我得到一个 404 错误未找到。 web.xml:


    <?xml version="1.0" encoding="UTF-8"?>
    <web-app id="WebApp_ID" version="4.0"
        xmlns="http://xmlns.jcp.org/xml/ns/javaee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd">
        <display-name>MktPortal</display-name>
        <welcome-file-list>
            <welcome-file>index.html</welcome-file>
            <welcome-file>index.htm</welcome-file>
            <welcome-file>index.jsp</welcome-file>
            <welcome-file>default.html</welcome-file>
            <welcome-file>default.htm</welcome-file>
            <welcome-file>default.jsp</welcome-file>
        </welcome-file-list>
        <jsp-config>
            <taglib>
                <taglib-uri>/birt.tld</taglib-uri>
                <taglib-location>/WEB-INF/tlds/birt.tld</taglib-location>
            </taglib>
        </jsp-config>
    </web-app>

viewReport.jsp:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib uri="/birt.tld" prefix="birt"%>
<!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=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
    <birt:viewer id="birtViewer" reportDesign="v_venditedispre.rptdesign"
        pattern="frameset" height="450" width="700" format="html">
    </birt:viewer>
</body>
</html>

这是错误:

【问题讨论】:

    标签: java jsp http-status-code-404 birt


    【解决方案1】:

    BIRT 将需要 BIRT 运行时来呈现 rptdesign 文件。 您使用的 Taglib 不包含运行时本身。

    要正确测试它,只需下载 BIRT 运行时 war 文件并部署到 Web 服务器中,并将 rptdesign 文件放入正确的路径,然后尝试渲染它。

    BIRT 运行时链接:http://www.eclipse.org/downloads/download.php?file=/birt/downloads/drops/R-R1-4.8.0-201806261756/birt-runtime-4.8.0-20180626.zip

    一旦您将运行时部署到同一个 Web 服务器,它就会开始工作。此外,建议将报告与核心应用程序代码分开。 这显然意味着创建一个目录来存储所有报告并指向该目录来选择报告文件。

    【讨论】:

    • 感谢您的回答,但我最终切换到了 jasperreport,因为 BIRT 似乎已被放弃,或者至少很少活跃,而且总是很难获得帮助和信息。
    猜你喜欢
    • 2014-07-08
    • 2016-11-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多