I have 2 main templates: one with a side menu, and one without it - and ui: include a common page containing ui: insert tags (the templates are quite large, so the basic example is below).
Using Mojarra, everything worked fine, but now I switched to MyFaces, ui: insert tags are ignored, and the contents of the ui: define associated with it are not displayed (that is, "Here are my results" are not displayed).
Should I specify include-page.xhtml as a template in some way? I tried
<ui:composition template="included-page.xhtml" />
instead
<ui:include src="included-page.xhtml" />
but lost CSS.
Hoping someone can suggest a solution :)
Thank you very much,
Neil
my-page.xhtml
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets" template="/templates/default-template.xhtml"> <ui:param name="title" value="My Title" /> <ui:define name="results"> Here are my results </ui:define> </ui:composition>
default is template.xhtml
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns:ui="http://java.sun.com/jsf/facelets"> <h:head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta> <title>#{title}</title> </h:head> <h:body> <ui:include src="included-page.xhtml" /> </h:body> </html>
included-page.xhtml
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"> <ui:insert name="results"> </ui:insert> </ui:composition>
source share