I'm trying to hide a table by pressing a button but I do not want to work, probably the answer is simple but I have not found it
this is my XHTML:
<!DOCTYPE html>
<html xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
xmlns="http://www.w3.org/1999/xhtml">
<h:head>
<title>TODO supply a title</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</h:head>
<body>
<h:form id="form">
<p:panel id="panel" rendered="#{dtBasicView.hola eq 1}">
<p:dataTable id="dt">
<p:column headerText="Hola"/>
<p:column headerText="Tabla"/>
<p:column headerText="Desaparece"/>
</p:dataTable>
</p:panel>
<p:commandButton value="Ostia!" action="#{dtBasicView.cambiar()}"
process="@this"
update=":form:panel form:dt">
</p:commandButton>
</h:form>
</body>
</html>
and this is my bean:
public class BasicView implements Serializable{
private Integer hola;
}
@PostConstruct
public void init(){
hola=1;
}
public void cambiar(){
hola=2;
}