Facelets funcionam?

3 respostas
leandroguima

Galera,

Tenho os seguintes arquivos

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:h="http://java.sun.com/jsf/html"
	  xmlns:f="http://java.sun.com/jsf/core"
	  xmlns:e="http://www.enverio.com/jsf"
	  xmlns:ui="http://java.sun.com/jsf/facelets"
	  xmlns:rich="http://richfaces.org/rich"	  
	  xmlns:a4j="http://richfaces.org/a4j">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
		<link href="/css/css.css" rel="stylesheet" type="text/css" />
		<title>Any title</title>
		<ui:insert name="head" />
	</head>
	<body>
		<div id="page">
			<div id="form" class="form">
				<h:form prependId="false">
					<div id="content">
						<ui:insert name="body">
							Default Body													
						</ui:insert>
					</div>
				</h:form>
			</div>				
		</div>
		<div id="footer">
			<div>Any text</div>
		</div>
	</body>
</html>
home.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:h="http://java.sun.com/jsf/html"
	  xmlns:f="http://java.sun.com/jsf/core"
	  xmlns:e="http://www.enverio.com/jsf"
	  xmlns:ui="http://java.sun.com/jsf/facelets"
	  xmlns:rich="http://richfaces.org/rich"	  
	  xmlns:a4j="http://richfaces.org/a4j">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
		<title></title>
	</head>
	<body>
		<ui:composition template="/template/template.xhtml">
			<ui:define name="page"></ui:define>
			<ui:include src="/lista.xhtml" />
		</ui:composition>		
	</body>
</html>
lista.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:h="http://java.sun.com/jsf/html"
	  xmlns:f="http://java.sun.com/jsf/core"
	  xmlns:e="http://www.enverio.com/jsf"
	  xmlns:ui="http://java.sun.com/jsf/facelets"
	  xmlns:rich="http://richfaces.org/rich"	  
	  xmlns:a4j="http://richfaces.org/a4j">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
		<title></title>
	</head>
	<body>		
		<h:dataTable var="lst" rendered="#{not empty customerHandler.lista}" value="#{customerHandler.lista}">				
			<f:facet name="header"><h:outputText value="Table of cusotmers" /></f:facet>				
			<h:column>
				<f:facet name="header">
					<h:outputText value="Nome" />
				</f:facet>
				<h:outputText value="#{lst.name}"/>			
			</h:column>
			
			<h:column>
				<f:facet name="header">
					<h:outputText value="Email" />
				</f:facet>
				<h:outputText value="#{lst.email}"/>			
			</h:column>
		</h:dataTable>
	</body>
</html>

Como fazer para incluir o arquivo lista.xhtml no arquivo home.xhtml?
Como fazer para que os estilos aplicados no template.xhtml (css) seja repassados para o arquivo home.xhtml?

Pessoal, já tentei de diversas formas, todas sem sucesso. Por favor se alguém puder me ajudar eu agradeço muito.

Obrigado

3 Respostas

Javabuntu

cara é bem simples, isto é suficiente pra te atender:
http://www.devmedia.com.br/articles/viewcomp.asp?comp=5332

leandroguima

Eu segui passo a passo esses materiais e não da certo de maneira alguma (os pontos que comentei)

Não deixa eu fazer include e o css do template não é renderizado nas demais páginas (nem no template).

leandroguima

Já descobri o problema. O plugin do Eclipse exibia o conteúdo corretamente, porém, ao acessar via browser o conteúdo não era exibido.
Valeu a todos, os exemplos seguidos funcionaram sim.

Criado 30 de maio de 2008
Ultima resposta 2 de jun. de 2008
Respostas 3
Participantes 2