I am seeing a bizarre defect. Here is a simple test case.
The managed bean is:
@ManagedBean
public class Controller {
private int counter = 0;
//getter and setters...
public String next() {
++counter;
return null;
}
public String prev() {
--counter;
return null;
}
}
The view is:
<h:form>
<p>Value: #{controller.counter}</p>
<h:inputHidden value="#{controller.counter}" />
<h:commandButton action="#{controller.prev()}" value="Previous" disabled="#{controller.counter == 0}"/>
<h:commandButton action="#{controller.next()}" value="Next" disabled="#{controller.counter == 5}"/>
</h:form>
When the view is first displayed, the Previous button is disabled. When I click Next, the Previous button becomes enabled. So far so good. But, when I click the Previous button, the action handler method prev() never gets called. If I remove the disabled attribute for the buttons, then everything works fine. Am I doing something wrong or is there a defect in Mojarra? I am using JBoss 7.1 and Mojarra. Thanks.