Pessoal estou fazendo teste utilizando XHTML. Mais minhas páginas sempre aparecem em branco. E no console não aparece nenhum erro: Estou usando o GlassFish versão 3 e JSF 2.0
Segue o código
WEB.XML
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<context-param>
<param-name>facelets.DEVELOPMENT </param-name>
<param-value>true </param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.validateXml </param-name>
<param-value>false </param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Faces Servlet Mapping -->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
<context-param>
<param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
<param-value>true</param-value>
</context-param>
</web-app>
template.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>
<ui:insert name="pageTitle">
<h:outputText value="CRUD Facelets "/>
</ui:insert>
</title>
</head>
<!-- <h:head>
<h:outputStylesheet library="css/1_1" name="common.css"/>
<h:outputScript library="js" name="menu.js" target="head"/>
<h:outputScript library="javax.faces" name="jsf.js"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
<ui:insert name="pageTitle">
<h:outputText value="PAULO"></h:outputText>
</ui:insert>
</title>
</h:head>
-->
<body>
<div id="topo" align="center">
<ui:insert name="topo">
Topo do CRUD Facelets
</ui:insert>
</div>
<div id="corpo" align="center">
<h:panelGrid width="990">
<h:panelGrid columns="1" cellpadding="0" cellspacing="0">
<f:facet name="header">
<h:outputText value="Teste"></h:outputText>
</f:facet>
<table class="tableBody"><tr><td>
<table align="center">
<tr><td>
<ui:insert name="body"></ui:insert>
</td></tr>
</table>
</td></tr></table>
<f:facet name="footer">
<h1>AQUI TEM UMA IMAGEM</h1>
</f:facet>
</h:panelGrid>
<h:panelGroup>
<ui:include src="footer.xhtml" />
</h:panelGroup>
</h:panelGrid>
</div>
<div id="rodape">
<ui:insert name="rodape">
<h:outputText value="Teste"></h:outputText>
<hr/>Rodapé CRUD Facelets
</ui:insert>
</div>
</body>
</html>
index.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<ui:composition template="/template.xhtml">
<ui:insert name="pageTitle">
<h:outputText value="NOVO TÍTULO"></h:outputText>
</ui:insert>
<ui:define name="navigationBar">
</ui:define>
<ui:define name="body">
<f:view>
<h:form id="createGatilhoForm">
<h:panelGrid columns="2" >
<ui:include src="/form.xhtml"/>
<f:facet name="footer">
<h:commandButton rendered="true" id="btnCreate" action="" value="Novo" />
<h:commandButton rendered="true" id="btnCancel" action="show" value="Cancelar" immediate="true"/>
</f:facet>
</h:panelGrid>
</h:form>
</f:view>
</ui:define>
</ui:composition>
</html>
[quote=paulofafism]Pessoal estou fazendo teste utilizando XHTML. Mais minhas páginas sempre aparecem em branco. E no console não aparece nenhum erro: Estou usando o GlassFish versão 3 e JSF 2.0
Segue o código
WEB.XML
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<context-param>
<param-name>facelets.DEVELOPMENT </param-name>
<param-value>true </param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.validateXml </param-name>
<param-value>false </param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Faces Servlet Mapping -->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
<context-param>
<param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
<param-value>true</param-value>
</context-param>
</web-app>
template.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>
<ui:insert name="pageTitle">
<h:outputText value="CRUD Facelets "/>
</ui:insert>
</title>
</head>
<!-- <h:head>
<h:outputStylesheet library="css/1_1" name="common.css"/>
<h:outputScript library="js" name="menu.js" target="head"/>
<h:outputScript library="javax.faces" name="jsf.js"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
<ui:insert name="pageTitle">
<h:outputText value="PAULO"></h:outputText>
</ui:insert>
</title>
</h:head>
-->
<body>
<div id="topo" align="center">
<ui:insert name="topo">
Topo do CRUD Facelets
</ui:insert>
</div>
<div id="corpo" align="center">
<h:panelGrid width="990">
<h:panelGrid columns="1" cellpadding="0" cellspacing="0">
<f:facet name="header">
<h:outputText value="Teste"></h:outputText>
</f:facet>
<table class="tableBody"><tr><td>
<table align="center">
<tr><td>
<ui:insert name="body"></ui:insert>
</td></tr>
</table>
</td></tr></table>
<f:facet name="footer">
<h1>AQUI TEM UMA IMAGEM</h1>
</f:facet>
</h:panelGrid>
<h:panelGroup>
<ui:include src="footer.xhtml" />
</h:panelGroup>
</h:panelGrid>
</div>
<div id="rodape">
<ui:insert name="rodape">
<h:outputText value="Teste"></h:outputText>
<hr/>Rodapé CRUD Facelets
</ui:insert>
</div>
</body>
</html>
index.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<ui:composition template="/template.xhtml">
<ui:insert name="pageTitle">
<h:outputText value="NOVO TÍTULO"></h:outputText>
</ui:insert>
<ui:define name="navigationBar">
</ui:define>
<ui:define name="body">
<f:view>
<h:form id="createGatilhoForm">
<h:panelGrid columns="2" >
<ui:include src="/form.xhtml"/>
<f:facet name="footer">
<h:commandButton rendered="true" id="btnCreate" action="" value="Novo" />
<h:commandButton rendered="true" id="btnCancel" action="show" value="Cancelar" immediate="true"/>
</f:facet>
</h:panelGrid>
</h:form>
</f:view>
</ui:define>
</ui:composition>
</html>
[/quote]
Mas e qual a solução Brother ? To com o mesmo problema no Tomcat 7.
Vlw
DRauber
[quote=paulofafism]Pessoal estou fazendo teste utilizando XHTML. Mais minhas páginas sempre aparecem em branco. E no console não aparece nenhum erro: Estou usando o GlassFish versão 3 e JSF 2.0
Segue o código
WEB.XML
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<context-param>
<param-name>facelets.DEVELOPMENT </param-name>
<param-value>true </param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.validateXml </param-name>
<param-value>false </param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Faces Servlet Mapping -->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
<context-param>
<param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
<param-value>true</param-value>
</context-param>
</web-app>
template.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>
<ui:insert name="pageTitle">
<h:outputText value="CRUD Facelets "/>
</ui:insert>
</title>
</head>
<!-- <h:head>
<h:outputStylesheet library="css/1_1" name="common.css"/>
<h:outputScript library="js" name="menu.js" target="head"/>
<h:outputScript library="javax.faces" name="jsf.js"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
<ui:insert name="pageTitle">
<h:outputText value="PAULO"></h:outputText>
</ui:insert>
</title>
</h:head>
-->
<body>
<div id="topo" align="center">
<ui:insert name="topo">
Topo do CRUD Facelets
</ui:insert>
</div>
<div id="corpo" align="center">
<h:panelGrid width="990">
<h:panelGrid columns="1" cellpadding="0" cellspacing="0">
<f:facet name="header">
<h:outputText value="Teste"></h:outputText>
</f:facet>
<table class="tableBody"><tr><td>
<table align="center">
<tr><td>
<ui:insert name="body"></ui:insert>
</td></tr>
</table>
</td></tr></table>
<f:facet name="footer">
<h1>AQUI TEM UMA IMAGEM</h1>
</f:facet>
</h:panelGrid>
<h:panelGroup>
<ui:include src="footer.xhtml" />
</h:panelGroup>
</h:panelGrid>
</div>
<div id="rodape">
<ui:insert name="rodape">
<h:outputText value="Teste"></h:outputText>
<hr/>Rodapé CRUD Facelets
</ui:insert>
</div>
</body>
</html>
index.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<ui:composition template="/template.xhtml">
<ui:insert name="pageTitle">
<h:outputText value="NOVO TÍTULO"></h:outputText>
</ui:insert>
<ui:define name="navigationBar">
</ui:define>
<ui:define name="body">
<f:view>
<h:form id="createGatilhoForm">
<h:panelGrid columns="2" >
<ui:include src="/form.xhtml"/>
<f:facet name="footer">
<h:commandButton rendered="true" id="btnCreate" action="" value="Novo" />
<h:commandButton rendered="true" id="btnCancel" action="show" value="Cancelar" immediate="true"/>
</f:facet>
</h:panelGrid>
</h:form>
</f:view>
</ui:define>
</ui:composition>
</html>
[/quote]
Solução que é bom nada. rsrsrs
Cara a sua dúvida pode ser a de outros. abs.
Opa!
A solução é dentro do web.xml coloca o <url-pattern>*.xhtml</url-pattern>
web.xml
<!-- Faces Servlet Mapping -->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
<url-pattern>*.faces</url-pattern>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
Aí vai bombar 
Vlw
DRauber