java 带有侦听器、更新和处理属性的primefaces ajax,不执行侦听器方法

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7916191/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 22:00:54  来源:igfitidea点击:

primefaces ajax with listener, update and process attributes, listener method does not executed

javajsf-2primefaces

提问by olyanren

I am using primefaces 3.0.0.M2 library. At this library, <p:selectOneMenu>element exists. My problem is that when I use <p:ajax>tag with listener, updateand processattributes, the listener method does not get invoked, but updateand processworks fine. Here is my code:

我正在使用 primefaces 3.0.0.M2 库。在这个库中,<p:selectOneMenu>元素存在。我的问题是,当我使用<p:ajax>与标签listenerupdateprocess属性,听者方法不被调用,但updateprocess正常工作。这是我的代码:

<h:form prependId="false" id="frmNewRecord">
    <h:panelGrid columns="4" style="font-size: 10px;width:840px">
        ??renci No <p:inputText value={newRecord.azerKimKayit.ogrenciNo}" maxlength="11">
            <p:ajax event="blur" update="frmNewRecord" listener="#{newRecord.getStudent}" process="frmNewRecord" />
</h:form>

And my backing bean is (necassary method) :

我的支持 bean 是(必要的方法):

public void getStudent() {
  azerKimKayit = azerKimKayitBo.findByOgrNo(azerKimKayit.getOgrenciNo());
}

回答by flynfish

Try passing in an AjaxBehavior Event in your method:

尝试在您的方法中传入 AjaxBehavior 事件:

public void getStudent(AjaxBehaviorEvent event) {
   azerKimKayit = azerKimKayitBo.findByOgrNo(azerKimKayit.getOgrenciNo());
}

回答by Jaron

In this question, BalusC suggests adding @thisto your processtag.

这个问题中,BalusC 建议添加@this到您的process标签中。