Java 在运行时添加了AjaxBehavior,但未调用AjaxBehaviorListener
我试图在运行时在Java 在运行时添加了AjaxBehavior,但未调用AjaxBehaviorListener,java,ajax,jsf,Java,Ajax,Jsf,我试图在运行时在组件中添加一些ajax行为。 我花了一天的时间来找出下一个代码出了什么问题,但没有成功 调用initUIComponent方法后,组件确实会触发ajax请求,并返回正常的ajax响应。但是,从未调用AjaxBehaviorListener。我错过了什么?我使用glassfish 3.1.2.2和默认的mojarra实现 public void initUIComponent(HtmlInputText c) { FacesContext fc = FacesContext
组件中添加一些ajax行为。
我花了一天的时间来找出下一个代码出了什么问题,但没有成功
调用initUIComponent
方法后,组件确实会触发ajax请求,并返回正常的ajax响应。但是,从未调用AjaxBehaviorListener。我错过了什么?我使用glassfish 3.1.2.2和默认的mojarra实现
public void initUIComponent(HtmlInputText c) {
FacesContext fc = FacesContext.getCurrentInstance();
AjaxBehavior ajaxBeh = (AjaxBehavior) fc.getApplication() .createBehavior(AjaxBehavior.BEHAVIOR_ID);
ajaxBeh.setRender(Collections.singletonList("elId1"));
ajaxBeh.setExecute(Collections.singletonList("@this"));
ajaxBeh.addAjaxBehaviorListener(new AjaxBehaviorListener() {
@Override
public void processAjaxBehavior(AjaxBehaviorEvent e)
throws AbortProcessingException {
System.out.println("Something is happening!");
}
});
c.addClientBehavior("keyup", ajaxBeh);
}
最后,这似乎是一个莫哈拉虫。代码在MyFaces上运行平稳。是相关的Jira问题(JAVASERVERFACES-2674)