JSF Facelets how to include external html?
Asked Answered
A

1

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.

using <ui:include src="http://mycompany.com/banner.html" /> causes the error The markup in the document following the root element must be well-formed..

How can i include this banner even if it's not well formed xml?

My current template:

<!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>
Aguayo answered 18/9, 2013 at 16:0 Comment(0)
K
12

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

Use the HTML <iframe> element instead.

<iframe src="http://mycompany.com/banner.html"></iframe>
Kyliekylila answered 18/9, 2013 at 16:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.