Amigos estou tentando ocultar e exibir um botão através do rendered
mas não esta dando certo
alguém pode ajudar ?
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.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"
xmlns:c="http://java.sun.com/jstl/core"
xmlns:p="http://primefaces.org/ui">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title><ui:insert name="titulo">Relatório</ui:insert></title>
<h:outputStylesheet library="css" name="style.css" />
<style type="text/css"></style>
</h:head>
<h:form id="frm">
<h:body>
<table border="1" >
<tr>
<td align="right" style="width: 1300px" >
<p:commandButton id="botao" uptade="panel1" action="#{relatorioMbean.exibirTotal()}" value="Entrar" > </p:commandButton>
</td>
</tr>
<tr>
<td>
<p:panel rendered="botao" id="panel1">
<h:outputLabel value="Teste Renderizar" />
</p:panel>
</td>
</tr>
</table>
</h:body>
</h:form>
</html>
O valor do atributo rendered de um elemento deve ser boolean (true ou false) ou uma expressão lógica (que, consequentemente, resulta em valor boolean).
Neste caso, você precisa dizer se o panel irá ou não ser exibido. Da forma que você fez é impossível dizer se é ou não para ele aparecer, na dúvida, ele é exibido.
<p:panel rendered="botao" id="panel1">
Deveria ser algo
<p:panel rendered="#{managedBean.propriedadeExibeOuNaoEstePanel}" id="panel1">
drsmachado deu certo da forma que vc falou para eu fazer e ficou conforme abaixo,
Muito Obrigado
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.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"
xmlns:c="http://java.sun.com/jstl/core"
xmlns:p="http://primefaces.org/ui">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title><ui:insert name="titulo">Relatório</ui:insert></title>
<h:outputStylesheet library="css" name="style.css" />
<style type="text/css"></style>
</h:head>
<h:form id="frm">
<h:body>
<table border="1" >
<tr>
<td align="right" style="width: 1300px" >
<p:commandButton id="botao" uptade="panel1" action="#{relatorioMbean.exibirTotal()}" value="Entrar" ajax="false"> </p:commandButton>
</td>
</tr>
<tr>
<td>
<p:panel rendered="#{relatorioMbean.totalDinamico}" id="panel1">
<h:outputLabel value="Teste Renderizar" />
</p:panel>
</td>
</tr>
</table>
</h:body>
</h:form>
</html>