Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSF Facelets how to include external html?

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>
like image 724
Catfish Avatar asked Sep 18 '13 16:09

Catfish


1 Answers

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>
like image 119
BalusC Avatar answered Nov 13 '22 11:11

BalusC