primefaces - Forced to use a HTML tag when using <ui:include> -
i'm using primefaces 5.2 , 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 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 problem: ribbon.xhtml have ribbon component menu access entire site, sensate idea put 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 eliminate css style , don't work properly, instead i'm forced 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 , css theme embedded in primefaces works too, mistery me why i'm forced use html tags in ribbon.xhtml, if use html tag in footer.xhtml ribbon fails.
in fact have problem utilizing ui:include / ui:component in layout scheme (ribbon/ navigationbean(content) / footer) because every component put in content.xhtml (i call navigationbean, see index.xhtml) don't work.
i'm thinking 2 problems related, maybe solving first 1 key solve other one.
i'm trying solve problem template doesn't work either.
the problem import, in bean put this:
import javax.faces.bean.managedbean; import javax.faces.view.*; @managedbean @viewscoped
and wrong, right import this:
import javax.faces.bean.managedbean; import javax.faces.bean.viewscoped; @managedbean @viewscoped
that solve me 2 problems commented early.
Comments
Post a Comment