myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rene van Wijk <rw...@transfer-solutions.com>
Subject RE: Rendered Property
Date Tue, 21 Jul 2009 13:46:30 GMT

 
During the restore view tour managed bean might return false, so JSF cannot bind the action
to the commandbutton. Is it a problem is you use the disabled attribute instead of the rendered
attribute?
-----Original message-----
From: SANTINI, Rafael <rafael@santini.eti.br>
Sent: Tue 21-07-2009 15:31
To: users@myfaces.apache.org; 
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 


Mime
View raw message