I'm using Primefaces 5.2 and this is my index:
<!DOCTYPE html>
<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:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title>Demo</title>
<!-- Incluyendo CSS: -->
<link rel="stylesheet" href="./css/style.css" type="text/css" media="all" />
</h:head>
<h:body >
<div id="header">
<h:form id="ribbon">
<ui:include src="/ribbon.xhtml"/>
</h:form>
</div>
<div id="section">
<ui:include src="#{navegacion.pageName}.xhtml"/>
</div>
<div id="footer">
<ui:include src="/footer.xhtml"/>
</div>
</h:body>
</html>
And my Navigation Bean:
package prueba;
import javax.faces.bean.ManagedBean;
import javax.faces.view.*;
@ManagedBean
@ViewScoped
public class navegacion {
private String pageName="condominios";
public navegacion() {
}
public String getPageName() {
return pageName;
}
public void setPageName(String pageName) {
this.pageName = pageName;
}
}
This is the problem: ribbon.xhtml have a ribbon component like a menu to access the entire site, the sensate idea is to put like this:
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:body>
<!-- Aqui agregamos un menu ribbon -->
<p:ribbon>
<!-- Ribbon Code Here -->
</p:ribbon>
</h:body>
</ui:composition>
But this eliminate the CSS style and don't work properly, instead I'm forced to make this:
<!DOCTYPE html>
<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:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title>Ribbon</title>
<link rel="stylesheet" href="./css/style.css" type="text/css" media="all" />
</h:head>
<p:ribbon >
<!-- Ribbon Code Here -->
</p:ribbon>
</html>
This work properly and the css theme embedded in Primefaces works too, but is a mistery to me why I'm forced to use the HTML tags in the ribbon.xhtml, if I use another html tag in footer.xhtml ribbon fails.
In fact I have a problem utilizing the ui:include / ui:component in this layout scheme (Ribbon/ navigationBean(content) / footer) because every component I put in content.xhtml (I call it with a navigationBean, see index.xhtml) don't work.
I'm thinking this two problems are related, maybe solving the first one is the key to solve the other one.
I'm trying to solve the problem with a template but it doesn't work either.