Hebert_Coelho 9 de dez. de 2012
Vc incluiu seu componente em uma página que tem h:head e h:body?
fer.ferreira6 10 de dez. de 2012
Sim e não.
Mas ambos os jeitos não funcionaram.
Hebert_Coelho 10 de dez. de 2012
fer.ferreira6:
Sim e não.
Mas ambos os jeitos não funcionaram.Use com h:head / h:body sempre. Os componentes do primefaces precisam.
Tente colocar o componente entre <h:form>.
Caso não funcione, coloque o project stage para development. Ele detalhará melhor caso algum erro aconteça.
fer.ferreira6 10 de dez. de 2012
Era isso mesmo Hebert Coelho
Todos os componentes do primefaces precisam do head e body, creio que seja pelo css, me corrija se estiver errado.
Para consultas futuras, o código fico dessa forma:
Template:
& lt ;? xml version = ' 1.0 ' encoding = ' UTF - 8 ' ? & gt ;
& lt ;! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" & gt ;
& lt ; html xmlns = "http://www.w3.org/1999/xhtml"
xmlns : h = "http://java.sun.com/jsf/html"
xmlns : ui = "http://java.sun.com/jsf/facelets"
xmlns : p = "http://primefaces.org/ui" & gt ;
& lt ; h : head & gt ;
& lt ; title & gt ; & lt ; / title & gt ;
& lt ; h : outputStylesheet library = "css" name = "estilo.css" /& gt ;
& lt ; / h : head & gt ;
& lt ; h : body & gt ;
& lt ; h : panelGroup id = "layout" layout = "block" styleClass = "layout" & gt ;
& lt ; h : panelGroup id = "topo" layout = "block" styleClass = "topo" & gt ;
Topo
& lt ; / h : panelGroup & gt ;
& lt ; h : panelGroup id = "menu" layout = "block" styleClass = "menu" & gt ;
& lt ; ui : insert name = "menu" & gt ;
& lt ; h : form & gt ;
& lt ; p : menu style = "width: 200px" & gt ;
& lt ; p : submenu label = "Opções" & gt ;
& lt ; p : menuitem value = "Notícias" /& gt ;
& lt ; p : menuitem value = "Tags" /& gt ;
& lt ; p : menuitem value = "Usuários" /& gt ;
& lt ; / p : submenu & gt ;
& lt ; p : submenu label = "Pessoal" & gt ;
& lt ; p : menuitem value = "Perfil" /& gt ;
& lt ; p : menuitem value = "Sair" /& gt ;
& lt ; / p : submenu & gt ;
& lt ; / p : menu & gt ;
& lt ; / h : form & gt ;
& lt ; / ui : insert & gt ;
& lt ; / h : panelGroup & gt ;
& lt ; h : panelGroup id = "conteudo" layout = "block" styleClass = "conteudo" & gt ;
& lt ; ui : insert name = "conteudo" /& gt ;
& lt ; / h : panelGroup & gt ;
& lt ; / h : panelGroup & gt ;
& lt ; / h : body & gt ;
& lt ; / html & gt ;
Componente:
& lt ; ? xml version = '1.0' encoding = 'UTF-8' ? & gt ;
& lt ; ! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" & gt ;
& lt ; html xmlns = "http://www.w3.org/1999/xhtml"
xmlns : cc = "http://java.sun.com/jsf/composite"
xmlns : h = "http://java.sun.com/jsf/html"
xmlns : p = "http://primefaces.org/ui"
xmlns : f = "http://java.sun.com/jsf/core" & gt ;
& lt ; cc : interface & gt ;
& lt ; cc : attribute name = "salvar" method - signature = "void action()" required = "true" /& gt ;
& lt ; cc : attribute name = "alterar" method - signature = "void action()" required = "true" /& gt ;
& lt ; cc : attribute name = "excluir" method - signature = "void action()" required = "true" /& gt ;
& lt ; / cc : interface & gt ;
& lt ; cc : implementation & gt ;
& lt ; p : toolbar & gt ;
& lt ; p : toolbarGroup align = "right" & gt ;
& lt ; p : commandButton id = "commandButtonSalvar" ajax = "false" value = "Salvar" action = "#{cc.attrs.salvar}" icon = "ui-icon-disk" /& gt ;
& lt ; p : commandButton id = "commandButtonAlterar" ajax = "false" value = "Alterar" action = "#{cc.attrs.alterar}" icon = "ui-icon-circle-check" /& gt ;
& lt ; p : commandButton id = "commandButtonExcluir" ajax = "false" value = "Excluir" action = "#{cc.attrs.excluir}" icon = "ui-icon-trash" /& gt ;
& lt ; / p : toolbarGroup & gt ;
& lt ; / p : toolbar & gt ;
& lt ; / cc : implementation & gt ;
& lt ; / html & gt ;
xhtml
& lt ; ui : composition template = "template/template.xhtml"
xmlns : ui = "http://java.sun.com/jsf/facelets"
xmlns : h = "http://java.sun.com/jsf/html"
xmlns : p = "http://primefaces.org/ui"
xmlns : f = "http://java.sun.com/jsf/core"
xmlns : comp = "http://java.sun.com/jsf/composite/componentes" & gt ;
& lt ; ui : define name = "conteudo" & gt ;
& lt ; h : head & gt ;
& lt ; / h : head & gt ;
& lt ; h : body & gt ;
& lt ; h : form id = "formTags" & gt ;
& lt ; comp : toolbar salvar = "#{metaTagController.salvar}"
alterar = "#{metaTagController.alterar}"
excluir = "#{metaTagController.excluir}" /& gt ;
& lt ; h : panelGroup id = "panelGroupNovo" layout = "block"
styleClass = "conteudo-bloco" & gt ;
& lt ; h : panelGrid id = "panelGridNovo" columns = "3" & gt ;
& lt ; h : outputLabel id = "panelGridNovoLabelNomeTag"
for = "panelGridInputTextNomeTag" value = "Tag:" /& gt ;
& lt ; p : inputText id = "panelGridInputTextNomeTag"
value = "#{metaTagBean.metaTag.tag}" size = "40" /& gt ;
& lt ; / h : panelGrid & gt ;
& lt ; / h : panelGroup & gt ;
& lt ; p : panel header = "Tags Cadastradas" toggleable = "true"
toggleOrientation = "horizontal" & gt ;
& lt ; h : panelGroup id = "panelGroupDataTable" layout = "block" & gt ;
& lt ; p : dataTable id = "dataTableListar" rowKey = "#{metaTag.id}"
var = "metaTag" selection = "#{metaTagBean.metaTag}"
selectionMode = "single" value = "#{metaTagBean.metaTags}" & gt ;
& lt ; p : ajax event = "rowSelect" update = ":formTags:panelGridNovo" /& gt ;
& lt ; p : column headerText = "Tag" sortBy = "#{metaTag.tag}"
filterBy = "#{metaTag.tag}" & gt ;
& lt ; h : outputText value = "#{metaTag.tag}" /& gt ;
& lt ; / p : column & gt ;
& lt ; / p : dataTable & gt ;
& lt ; / h : panelGroup & gt ;
& lt ; / p : panel & gt ;
& lt ; / h : form & gt ;
& lt ; / h : body & gt ;
& lt ; / ui : define & gt ;
& lt ; / ui : composition & gt ;
Hebert_Coelho 10 de dez. de 2012
É rapaz, isso é tenso.
Não sei c te falar se ele precisa do head/body para o css ou para outras coisas. C não me engano é para o cascade do css dele, mas não posso afirmar.
Pelo menos está resolvido! \o/