JSF Facelets如何包含外部html? [英] JSF Facelets how to include external html?

查看:82
本文介绍了JSF Facelets如何包含外部html?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个正在开发的应用程序,我的公司有一个标题横幅,该标题必须显示在所有页面上.我的标题横幅小组中有大约6个不同的版本,现在我要制作它,以便仅将源中的横幅包含到我的应用中,以便如果他们更新了横幅的源,则是我应用的版本横幅也会自动更新.

I have an app that i'm developing and my company has a header banner that is required to be on all pages. We have about 6 different versions floating around my team of that header banner and I now want to make it so that I just include the banner from the source into my app so that if they update the source of the banner, my app's version of the banner is automatically updated as well.

使用<ui:include src="http://mycompany.com/banner.html" />会导致错误The markup in the document following the root element must be well-formed..

即使XML格式不正确,我如何也可以包含它?

How can i include this banner even if it's not 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>

推荐答案

出于将外部资源嵌入HTML文档的目的,Facelets <ui:include>标签是错误的工具.

The Facelets <ui:include> tag is the wrong tool for the purpose of embedding external resources in a HTML document.

请改用HTML <iframe>元素.

Use the HTML <iframe> element instead.

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

这篇关于JSF Facelets如何包含外部html?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆