JSF Facelets如何包含外部HTML?

6
我正在开发一款应用程序,我的公司要求在所有页面上都有页眉横幅。我们团队中有大约6个不同版本的页眉横幅,并且现在我想让它从源代码中被包含到我的应用程序中,这样如果他们更新了横幅的源代码,我的应用程序中的横幅版本也会自动更新。
使用<ui:include src="http://mycompany.com/banner.html" />会导致错误The markup in the document following the root element must be well-formed.
即使它不是格式良好的XML,我该如何包含此横幅?
我的当前模板:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:p="http://primefaces.org/ui"
    xmlns:ui="http://java.sun.com/jsf/facelets">

<ui:composition>

<h:body>
    <div>
      <ui:include src="http://mycompany.com/banner.html" />
    </div>

    <ui:insert name="content" />
</h:body>
</ui:composition>
</html>
1个回答

12

Facelets的<ui:include>标签不适合用于在HTML文档中嵌入外部资源。

请改用HTML的<iframe>元素。

<iframe src="http://mycompany.com/banner.html"></iframe>

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接