[英]Call Javascript function on receiving ajax response in JSF 2.0
I'm using JSF 2.0 and it's new (actually old, but now incorporated in JSF) ajax features. 我正在使用JSF 2.0,它是新的(实际上很旧,但现在已经包含在JSF中)ajax功能。
I have something like this: 我有这样的事情:
<h:inputText id="name" value="#{coordinatesMBean.name}"/>
<h:commandButton value="Reverse me!">
<f:ajax execute="name" render="reverseName"/>
</h:commandButton>
<h:outputText id="reverseName" value="#{coordinatesMBean.reverseName}"/>
It works fine, after hitting button value from inputText is sent to server, put into managed bean, and reverseName
is rerendered with new data. 它工作正常,从inputText命中按钮值后发送到服务器,放入托管bean,并使用新数据reverseName
。
What I want to do is not only rerendering reverseName
, but also call some Javascript function when ajax response is received. 我想做的不仅是reverseName
,还在收到ajax响应时调用一些Javascript函数。
<f:ajax>
has onevent
and onerror
attributes. <f:ajax>
具有onevent
和onerror
属性。 Give them a try. 试一试。
Alternatively, Richfaces <a4j:support>
has the oncomplete
attribute for that purpose. 或者,Richfaces <a4j:support>
具有用于该目的的oncomplete
属性。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.