Apache Tomee 7.0.1 上 h:selectOneRadio 的奇怪问题
Weird issue with h:selectOneRadio on Apache Tomee 7.0.1
我无法让 f:ajax
侦听器在最简单的 JSF 2.2 页面上工作。值已分配,但听者是聋子。奇怪的是,如果我用 h:selectOneMenu
替换 h:selectOneRadio
,同样的代码工作得很好。这是 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>
和豆子:
@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);
}
}
没有为 h:selectOneRadio
触发任何侦听器方法类型。将 bean 设为 @ManagedBean
并使用不同的 ajax 事件类型也无济于事。
将 Apache Tomee 升级到版本 7.0.1(MyFaces 2.2.10、JSF 2.2)后出现此问题。与 MyFaces 到 2.2.11 的问题相同。
Web 应用程序捆绑在一个耳朵里,没有加载其他 JSF 库,没有 Primefaces 和类似的东西,没有 servlet 过滤器,什么都没有 - 一个纯 JSF 2.2 应用程序。
有什么想法吗?
MyFaces 中存在一个错误,将在 MyFaces 2.2.12 中修复。
如果您需要立即解决方案,请使用 MyFaces 快照,它们似乎工作正常,只需将它们放在 Tomee 的 lib 文件夹中,而不是 myfaces-api-*
和 myfaces-impl-*
.