<ui:define name="description" rendered="false">
<meta name="description" content="do not render" />
</ui:define>
Run Code Online (Sandbox Code Playgroud)
我在我的xhtml页面中使用此代码,当我运行应用程序时,元描述仍在渲染.我想根据某些条件使用元描述标签.主布局:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<ui:insert name="description" />
</h:head>
...........
</html>
Run Code Online (Sandbox Code Playgroud)
网页:
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"
template="/templates/masterLayout.xhtml">
<ui:define name="description" rendered="false">
<meta name="description" content="do not render" />
</ui:define>
...........
</ui:composition>
Run Code Online (Sandbox Code Playgroud)
Bal*_*usC 16
这<ui:define>是一个在视图构建时运行的标记处理程序,而不是UIComponent在视图渲染时运行的标记处理程序.因此它不支持的rendered属性.任何不受支持的属性都会被忽略.
请<ui:fragment>改用.
<ui:define name="description">
<ui:fragment rendered="false">
<meta name="description" content="do not render" />
</ui:fragment>
</ui:define>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13000 次 |
| 最近记录: |