Fórum JSF 2.0 facelets include #431475

21/12/2012

0

Pessoal tudo bem ...

estou com um problema em um pequeno projeto com JSF 2.0 e templates facelets ...
estou recebendo a seguinte mensagem ... :

/times.xhtml @12,52 <ui:include src="/formulario-novo-time.xhtml"> Invalid path : /formulario-novo-time.xhtml

parece estar tudo certo.

segue o codigo das paginas:

template
<?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">
<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:ui="http://java.sun.com/jsf/facelets">

<h:head>
	<title>K19 Futebol</title>
</h:head>
<h:body>

	<h:outputStylesheet library="css" name="style.css" />

	<div id="header">
		<h:form style="float:left">
			<h:link value="Times" outcome="times" />

			<h:link value="Jogadores" outcome="jogadores" />

		</h:form>
		<h:graphicImage library="imagens" name="logok19.png" style="float:right" />
		
		<div style="clear:both"></div>
	</div>

	<div id="content">

		<ui:insert name="conteudo"> Espaço Reservado para o cconteudo da Tela</ui:insert>
	</div>

	<div id="footer" style="text-align: center">

		<hr />
		© K19. Todos os direitos reservados
	</div>

</h:body>
</html>




times.xhtml
<?xml version="1.0" encoding="UTF-8"?> 
<ui:composition template="/WEB-INF/templates/template.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets">

	<ui:define name="conteudo">

		<h1>Times</h1>
		<h:form>
			<ui:include src="/formulario-novo-time.xhtml" />
			<ui:include src="/lista-de-times.xhtml" />
		</h:form>
	</ui:define>
	</ui:composition>


formulario-novo-time.xhtml
<?xml version="1.0" encoding="UTF-8"?>
<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:ui="http://java.sun.com/jsf/facelets">

	<h:inputHidden value="#{timeBean.time.id}" />
	<h:panelGrid columns="3">

		<h:outputLabel value="Nome: " for="nome" />
		<h:inputText id="nome" requered="true"
			requiredMessage="O nome do time é obrigatório"
			value="#{timeBean.time.nome}" />
		<h:message for="nome" />

		<h:outputLabel value="Técnico" for="tecnico" />
		<h:inputText value="#{timeBean.time.tecnico}" id="tecnico"
			required="true" requiredMessage="O nome do técnico é obrigatório." />
		<h:message for="tecnico" />

		<h:commandButton value="Cadastrar">

			<f:ajax event="click" execute="@form" listener="#{timeBean.adiciona}"
				render="@all" />
		</h:commandButton>

	</h:panelGrid>

</ui:composition>


lista-de-times.xhtml
<?xml version="1.0" encoding="UTF-8"?>
<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:ui="http://java.sun.com/jsf/facelets">

	<h:panelGroup rendered="#{not empty timeBean.times}">

		<h2>Lista de Times</h2>
		<h:dataTable id="tabela" value="#{timeBean.times}" var="time"
			styleClass="dados" rowClasses="par, impar">

			<h:column>
				<f:facet name="header">
					<h:outputText value="ID" />
				</f:facet>
				#{time.id}
			</h:column>

			<h:column>
				<f:facet name="header">
					<h:outputText value="Nome" />
				</f:facet>
				#{time.nome}
			</h:column>

			<h:column>
				<f:facet name="header">
					<h:outputText value="Técnico" />
				</f:facet>
				#{time.tecnico}
			</h:column>

			<h:column>
				<f:facet name="header">
					<h:outputText value="Alterar" />
				</f:facet>
				
				<f:ajax event="click" render="@form" listener="#{timeBean.preparaAlteracao}">
				<h:commandLink >
				<f:param  name="id" value="#{time.id}"/>
				Alterar
				</h:commandLink>
				</f:ajax>
			</h:column>
			
			<h:column>
				<f:facet name="header">
					<h:outputText value="Remover" />
				</f:facet>
				
				<f:ajax event="click" render="@form" listener="#{timeBean.remove}">
				<h:commandLink>Remover
				<f:param  name="id" value="#{time.id}"/>
				</h:commandLink>
				</f:ajax>
			</h:column>			



		</h:dataTable>

	</h:panelGroup>

</ui:composition>



Quando executo vem a mensagem referida:

javax.faces.view.facelets.TagAttributeException: /times.xhtml @12,52 <ui:include src="/formulario-novo-time.xhtml"> Invalid path : /formulario-novo-time.xhtml
	at com.sun.faces.facelets.tag.ui.IncludeHandler.apply(IncludeHandler.java:125)
	at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
	at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
	at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:188)
	at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
	at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
	at com.sun.faces.facelets.tag.ui.DefineHandler.applyDefinition(DefineHandler.java:103)
	at com.sun.faces.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:178)
	at com.sun.faces.facelets.impl.DefaultFaceletContext$TemplateManager.apply(DefaultFaceletContext.java:395)
	at com.sun.faces.facelets.impl.DefaultFaceletContext.includeDefinition(DefaultFaceletContext.java:366)
	at com.sun.faces.facelets.tag.ui.InsertHandler.apply(InsertHandler.java:108)
	at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
	at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
	at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:188)
	at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
	at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
	at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93)
	at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
	at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:86)
	at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:308)
	at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:367)
	at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:346)
	at com.sun.faces.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:199)
	at com.sun.faces.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:155)
	at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93)
	at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:86)
	at com.sun.faces.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:152)
	at com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:769)
	at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:100)
	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
	at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:410)
	at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1534)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
	at br.com.jpajsf.web.filter.JPAFilter.doFilter(JPAFilter.java:42)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
	at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
	at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)
	at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)
	at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:326)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:227)
	at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:170)
	at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:822)
	at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:719)
	at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1013)
	at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
	at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
	at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
	at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
	at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
	at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
	at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
	at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
	at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
	at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
	at java.lang.Thread.run(Thread.java:662)

+- Component Tree
<UIViewRoot id="j_id1" inView="true" locale="pt_BR" renderKitId="HTML_BASIC" rendered="true" transient="false" viewId="/times.xhtml">
<?xml version="1.0" encoding="UTF-8"?>
<?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">
<html xmlns="http://www.w3.org/1999/xhtml">
<UIOutput id="j_idt4" inView="true" rendered="true" transient="false">
<title>K19 Futebol</title>
</UIOutput>
</UIViewRoot>



Valeu galera .. aguardo ....
André Henrique

André Henrique

Responder

Posts

24/12/2012

Davi Costa

Conferi se o arquivo está na pasta correta e se o nome dele está batendo com o código

att Davi
Responder

Gostei + 0

25/12/2012

André Henrique

esta tudo correto com relação a nomes e caminhos ...
vi alguns post's na internet falando sobre a pagina de codigo utf8 ou iso mas não resolveu ..
aparentemente ta tudo certinho e não carrega ...
se eu criar o conteudo em paginas seperadas e chamar funciona ...

Responder

Gostei + 0

21/03/2013

Jmarcel

Cara, tenho certeza que isso é problema de encoding.
Faz o seguinte: remova todos os acentos e/ou caracteres especiais dos values, var etc.

Por exemplo:
<h:outputText value="Técnico" />

Mude para:
<h:outputText value="Tecnico" />


Aí funciona.
Responder

Gostei + 0

21/03/2013

Davi Costa

Vc falou em páginas, mas vc já postou em páginas separadas? Ou vc quiz dizer pastas?

att Davi
Responder

Gostei + 0

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar