问题描述
一个 a4j:commandLink
或 a4j:commandButton
的事件顺序是什么?
What is the event sequence of a a4j:commandLink
or a4j:commandButton
?
是对的: onclick
- > actionListner
> oncomplete
- > reRender
?
Is it right: onclick
->actionListner
->oncomplete
->reRender
?
是 reRender
来自 oncomplete
?
当
When action
happens?
推荐答案
onclick
最终用户点击生成的HTML元素时,JavaScript被称为第一个。当JavaScript代码不返回 false
时,所有关联的 ActionListener
在JSF中的实现将按照它们与组件的关联的顺序来调用它。如果听众没有抛出任何异常,那么真正的动作
将被调用。当操作
返回成功的响应时,在 reRender
中指定的组件将在客户端更新。最后,将调用 oncomplete
JavaScript。
The onclick
JavaScript is called the first when the enduser clicks the generated HTML element. When the JavaScript code does not return false
, then all associated ActionListener
implementations in the JSF side will be invoked, in the order of their association with the component. If the listeners haven't thrown any exception, then the real action
will be invoked. When the action
returns a successful response, then the components specified in reRender
will be updated in the client side. Finally the oncomplete
JavaScript will be called.
如果您有两个客户端和服务器端,并知道如何使用它。我强烈推荐客户端使用Firebug,在服务器端推荐使用Eclipse。您当然也可以使用 alert()
s或 System.out.println()
s来做穷人的调试。
It's pretty easy to track yourself if you have a debugger in both the client and server side and know how to use it. I strongly recommend Firebug for the client side and Eclipse for the server side. You can of course also always do poor man's debugging using alert()
s or System.out.println()
s.
这篇关于什么是a4j事件序列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!