PrimeFaces 3.0以来、それは非常にカスタマイズ可能なリソースの順序を提供します。
以下の順序を参照してください:
{空} 1。定義されている場合は「ファースト」ファセット。
<f:facet name="first">
<!-- load css, js or others -->
</f:facet>
{空} 2。 PrimeFaces – JSFがCSSを登録しました。 3. PrimeFaces – テーマCSS。 4.定義されている場合、「中間」ファセット。
<f:facet name="middle">
<!-- load css, js or others -->
</f:facet>
{空} 5。 PrimeFaces – JSFがJSを登録しました。 h:ヘッド内容。
<h:head>
<!-- load css, js or others -->
</h:head>
{空} 7。定義されている場合は「最後」のファセット。
<f:facet name="last">
<!-- load css, js or others -->
</f:facet>
1.例
一般的な使用例は、 ”
first
“ファセットを介して “meta”タグを追加し、 ”
last
“ファセットを介して “css”を上書きすることです。 「中間」ファセットはめったに使用されません。
demo.xhtml
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<h:head>
<h:outputStylesheet library="default" name="css/bootstrap.css"/>
<h:outputScript library="primefaces" name="jquery/jquery.js"/>
<f:facet name="first">
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
<title>Resource ordering in PrimeFaces</title>
</f:facet>
</h:head>
<h:body>
<f:facet name="last">
<h:outputStylesheet library="default" name="css/style.css"/>
</f:facet>
</h:body>
2.結果
上記のJSFタグは、次のHTML出力を生成します。
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- comment : "first" faces -->
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
<title>Resource ordering in PrimeFaces</title>
<!-- comment : PF-JSF registered CSS or Theme CSS -->
<link type="text/css" rel="stylesheet"
href="/mkyong/javax.faces.resource/css/bootstrap.css.jsf?ln=default&v=1__0"/>
<link type="text/css" rel="stylesheet"
href="/mkyong/javax.faces.resource/primefaces.css.jsf?ln=primefaces"/>
<!-- comment : "last" faces -->
<link type="text/css" rel="stylesheet"
href="/mkyong/javax.faces.resource/css/style.css.jsf?ln=default&v=1__0"/>
<script type="text/javascript"
src="/mkyong/javax.faces.resource/jquery/jquery.js.jsf?ln=primefaces">
</script>
<script type="text/javascript"
src="/mkyong/javax.faces.resource/primefaces.js.jsf?ln=primefaces">
</script>
</head>
<body>
...
</body>
...