I can not get an f:ajax
listener working on a simplest JSF 2.2 page. Values are assigned, but the listener is deaf. Strangely, the very same code is working perfectly fine if I replace h:selectOneRadio
with h:selectOneMenu
. Here is the html:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:h="http://xmlns.jcp.org/jsf/html">
<h:head>
<title>Test</title>
</h:head>
<h:body>
<h:form id="f" >
<h:selectOneRadio id="r" value="#{test.mode}">
<f:selectItem itemValue="One"/>
<f:selectItem itemValue="Two"/>
<f:selectItem itemValue="Three"/>
<f:ajax render="@form" execute="@form" listener="#{test.listener2()}"/>
</h:selectOneRadio>
<br/>
<h:outputText id="out" value="#{test.mode}"/>
</h:form>
</h:body>
</html>
and the bean:
@Named
@SessionScoped
public class Test implements Serializable {
private final static Logger LOG = Logger.getLogger(Test.class.getName());
private String mode;
public String getMode() {
return mode;
}
public void setMode(String mode) {
this.mode = mode;
LOG.info("Mode setter: " + mode);
}
public void listener1(AjaxBehaviorEvent event) throws AbortProcessingException {
LOG.info("Mode listener 1: " + mode);
}
public void listener2() {
LOG.info("Mode listener 2: " + mode);
}
}
Neither of the listener method types are fired for h:selectOneRadio
. Making the bean as @ManagedBean
and using different ajax event types were to no help either.
The issue appeared after upgrading of Apache Tomee to version 7.0.1 (MyFaces 2.2.10, JSF 2.2). Same problem with MyFaces to 2.2.11.
The web app is bundled inside an ear, no other JSF libraries are loaded, no Primefaces and similar, no servlet filters, no nothing at all - a pure JSF 2.2 application.
Any ideas?
There's a bug in MyFaces, will be fixed in MyFaces 2.2.12.
Should you need an immediate solution, use MyFaces snapshots, they seem to be working fine, just drop them in Tomee's lib folder instead of the stock versions of myfaces-api-*
and myfaces-impl-*
.