The problem was solved putting <t:saveState value="#{bean.campo1}"/>.
----- Original Message -----
From: "SANTINI, Rafael" <[email protected]>
To: <[email protected]>
Sent: Tuesday, July 21, 2009 10:31 AM
Subject: Rendered Property
Hi,
In the following code, the last two components are rendered on the
condition "#{bean.campo1 != null}". When the bean.campo1 is different that
null, they are displayed. But, when the last button is clicked, the testar
method is not invoked. What I'm missing?
<h:messages/>
<h:form>
<h:inputText value="#{bean.campo1}"/>
<h:commandButton value="OK"/>
<h:inputText value="#{bean.campo2}" rendered="#{bean.campo1 != null}"/>
<h:commandButton value="Testar" action="#{bean.testar}"
rendered="#{bean.campo1 != null}"/>
</h:form>
public class Bean {
private String campo1;
private String campo2;
public String getCampo1() {
return campo1;
}
public void setCampo1(String campo1) {
this.campo1 = campo1;
}
public String getCampo2() {
return campo2;
}
public void setCampo2(String campo2) {
this.campo2 = campo2;
}
public void testar() {
campo2 += "_OK";
}
}
Thanks,
Rafael Santini