Given: a primefaces 5.3 application with the following xhtml
<h:form id="form" enctype="multipart/form-data">
<p:messages id="serversMessages" showDetail="true" autoUpdate="true" closable="true" />
<p:selectOneListbox value="#{servers.model.selectedServer}" style="min-width:300px">
<p:ajax event="change" listener="#{servers.onServerSelected}" update=":form" />
<f:selectItems value="#{servers.model.servers}" var="srv" itemValue="#{srv.serverInfoId}" itemLabel="#{srv.name}" />
</p:selectOneListbox>
<p:column><p:inputText value="#{servers.model.edit.name}" /></p:column>
<p:commandButton id="newServerBtn" actionListener="#{servers.onNewServerClicked}" value="New" update=":form"></p:commandButton>
<p:commandButton id="updServerBtn" disabled="#{empty servers.model.selectedServer}" actionListener="#{servers.onSaveClicked}" value="Save" update=":form"></p:commandButton>
<p:commandButton id="tmpServerBtn" actionListener="#{servers.onTempClicked}" value="Temp2" update=":form"></p:commandButton>
</h:form>
When: I click on the updServerBtn (it's enabled when an item in the list has been selected)
Expectation: The backing bean method will be called.
But actually: The backing bean method is NOT called.
Observations:
If I remove the disabled property the backing bean is called.
The tmpServerBtn invokes a backing bean method.
When I click on the updServerBtn, an XHR happens with a 200 response.
The bean does not work properly when it is View or Request scoped but does work at the Session scoped level.
Analysis:
It would seem like that Primefaces is deciding that it is not worthwhile to call the backing bean method.
Similar Questions
Before posting my question, I did find this post here:
commandButton/commandLink/ajax action/listener method not invoked or input value not updated
When I remove the disabled attribute of the updServerBtn, the backing bean method does get invoked. This suggests to me that the possible causes of problems in the above post, probably don't apply.