JSF-Inhalt <f: facet> wird nicht gerendert
Ich habe eine Seite, auf der ich einige Komponenten in einer verschachteln muss<f:facet name="last>
, um benutzerdefinierte Stile anzuwenden (Ich verwende Primefaces und auf diese Weise können sie die CSS-Prioritätsreihenfolge wie erwähnt handhabenHier). Aber ich kann nichts rendern, was sich in der befindet<f:facet>
Stichworte.
Hier ist ein Beispielcode:
<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>
<title>TODO supply a title</title>
</h:head>
<h:body>
<div>
<h:form>
<h:outputLabel for="loginField" value="Login:" styleClass="form-label"/>
<p:inputText id="loginField" value="#{subscriptionBean.login}" styleClass="form-field"/>
<f:facet name="last">
<h:outputLabel for="pwd2" value="Password:" styleClass="form-label"/>
<p:password id="pwd2" value="#{subscriptionBean.password}" required="true" match="pwd1" styleClass="form-field"/>
<p:message for="pwd2" display="text" styleClass="form-field"/>
</f:facet>
</h:form>
</div>
</h:body>
Sollte ich das Passwort-Eingabefeld auf der generierten Seite nicht sehen können? Es wird einfach nicht angezeigt.
Die Antwort von starf lautet wie folgt:
<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>
<f:facet name="last">
<h:outputStylesheet library="css" name="default.css"/>
</f:facet>
</h:head>
<h:body>
<h:outputText value="Rendered text!"/>
<h:form>
<h:outputLabel for="pdw1" value="Password: "/>
<p:password id="pwd1" required="true"/>
<p:message for="pwd1"/>
</h:form>
</h:body>
Und der resultierende gerenderte Seitenkopf:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link type="text/css" rel="stylesheet" href="/AquitelManagement/faces/javax.faces.resource/default.css?ln=css" />
<link type="text/css" rel="stylesheet" href="/AquitelManagement/faces/javax.faces.resource/primefaces.css?ln=primefaces&v=5.0.RC2" />
<script type="text/javascript" src="/AquitelManagement/faces/javax.faces.resource/jquery/jquery.js?ln=primefaces&v=5.0.RC2">
</script><script type="text/javascript" src="/AquitelManagement/faces/javax.faces.resource/jquery/jquery-plugins.js?ln=primefaces&v=5.0.RC2">
</script>
<script type="text/javascript" src="/AquitelManagement/faces/javax.faces.resource/primefaces.js?ln=primefaces&v=5.0.RC2">
</script>
</head>
<body>...