问题
I have a page that uses a template
<ui:composition template="/WEB-INF/facelets/templates/clientPage.xhtml">
I was hoping to only render the compatibility view for this particular page using the meta tag
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
The tag does not work unless I add it to the root template page. Is there a way I can add it to specific pages that use the template.
回答1:
Declare an <ui:insert>
in the master template at the desired location:
clientPage.xhtml
<!DOCTYPE html>
<html ...>
...
<h:head>
<ui:insert name="head-meta" />
...
</h:head>
...
</html>
Extend the master template with another master template:
i18ClientPage.xhtml
<ui:composition template="/WEB-INF/facelets/templates/ie8ClientPage.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
>
<ui:define name="head-meta">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
</ui:define>
</ui:composition>
Finally let those template clients use this master template instead.
来源:https://stackoverflow.com/questions/19307646/can-i-add-a-meta-tag-to-a-particular-page-that-is-using-templates