Estou desenvolvendo o template, a minha estrutura esta no anexo
segue abaixo o meu codigo :
index.xhtml
<?xml version='1.0' encoding='UTF-8' ?><!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><ui:compositionxmlns:ui="http://java.sun.com/jsf/facelets"template="./../template/Template.xhtml"><ui:definename="top">top
</ui:define><ui:definename="left">left
</ui:define><ui:definename="content">content
</ui:define><ui:definename="bottom">bottom
</ui:define></ui:composition>
template.xhtml
<?xml version='1.0' encoding='UTF-8' ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"xmlns:ui="http://java.sun.com/jsf/facelets"xmlns:h="http://java.sun.com/jsf/html"><h:head><metahttp-equiv="Content-Type"content="text/html; charset=UTF-8"/><linkhref="./../resources/css/default.css"rel="stylesheet"type="text/css"/><linkhref="./../resources/css/cssLayout.css"rel="stylesheet"type="text/css"/><title>FaceletsTemplate</title></h:head><h:body><divid="top"><ui:insertname="top">Top</ui:insert></div><div><divid="left"><ui:insertname="left">Left</ui:insert></div><divid="content"class="left_content"><ui:insertname="content">Content</ui:insert></div></div><divid="bottom"><ui:insertname="bottom">Bottom</ui:insert></div></h:body></html>
quando acesso o template.xhtml aparece normalmente o layout, mas quando acesso o index.xhtml nao aparece o
layout, da a impressão que nao esta achando o template.
// Declaração do template<ui:compositiontemplate="/templates/template.xhtml"><ui:definename="conteudo">//Aqui vai o conteúdo da página </ui:define></ui:composition>
E
evandro_araujo
meu index, esta na pasta PAGE, e tentei fazer dessa forma :
criei um projeto teste e não tive o problema que está relatando. Vou postar os códigos, veja se pode te ajudar vlw!
Abraços..
P.S. utilizei e mesma estrutura de diretórios mencionado, limpei e construí o projeto usando NetBeans + Glassfish e apenas executei o arquivo index.xhtml (Shift + F6)
template.xhtml
<?xml version='1.0' encoding='UTF-8' ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"xmlns:ui="http://java.sun.com/jsf/facelets"xmlns:h="http://java.sun.com/jsf/html"><h:head><metahttp-equiv="Content-Type"content="text/html; charset=UTF-8"/><linkhref="./../resources/css/default.css"rel="stylesheet"type="text/css"/><linkhref="./../resources/css/cssLayout.css"rel="stylesheet"type="text/css"/><title>Facelets Template</title></h:head><h:body><divid="top"><ui:insertname="top">Top</ui:insert></div><div><divid="left"><ui:insertname="left">Left</ui:insert></div><divid="content"class="left_content"><ui:insertname="content">Content</ui:insert></div></div><divid="bottom"><ui:insertname="bottom">Bottom</ui:insert></div></h:body></html>
index.xhtml
<?xml version='1.0' encoding='UTF-8' ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"xmlns:ui="http://java.sun.com/jsf/facelets"xmlns:p="http://primefaces.org/ui"><ui:compositiontemplate="../template/template.xhtml"><ui:definename="top">
top
</ui:define><ui:definename="left">
left
</ui:define><ui:definename="content">
content
</ui:define><ui:definename="bottom">
bottom
</ui:define></ui:composition></html>
e web.xml
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> javax.faces.PROJECT_STAGE Development