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
primefaces ajax with listener, update and process attributes, listener method does not executed
提问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
, update
and process
attributes, the listener method does not get invoked, but update
and process
works fine. Here is my code:
我正在使用 primefaces 3.0.0.M2 库。在这个库中,<p:selectOneMenu>
元素存在。我的问题是,当我使用<p:ajax>
与标签listener
,update
和process
属性,听者方法不被调用,但update
和process
正常工作。这是我的代码:
<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 @this
to your process
tag.
在这个问题中,BalusC 建议添加@this
到您的process
标签中。