Primefaces AJAX callbacks: onstart vs. onclick
2013-07-24 14:49
260 查看
Primefaces AJAX callbacks: onstart vs. onclick
I just learned the hard way that onstart and onclick are not the same thing.In particular, a "return ..." has very different semantics in both cases.
Consider this code:
<p:commandLink action="#{bean.method}" onstart="return func()" ...>
If "func()" return false, this code will abort the AJAX request and bean.method() won't get called.
If "func()" returns true, the AJAX request processes.
If you replace onstart with onclick, the AJAX request will abort even if func() returns true.
That's because the Primefaces puts the code to generate the AJAX request in the onclick handler, pre-pending your code from the p:commandLink onclick before it. If your code returns, the AJAX request never gets sent.
http://wrschneider.blogspot.com/2012/01/primefaces-ajax-callbacks-onstart-vs.html
相关文章推荐
- PrimeFaces Ajax Callbacks [ (xhr, status, args) ]
- 理解PrimeFaces process/update和JSF f:ajax execute/render属性
- ActivityLifecycleCallbacks,Android API Level >=14 无需手工干涉,监控Activity 运行情况(onCreate,OnStart...等)
- vs 2008 sp1 - Unable to start debugging on web server. An authentication error occurred...
- PrimeFaces vs RichFaces vs IceFaces
- JSF + Primefaces: Problem with “rendered” components with ajax
- 调用startActivityForResult,onActivityResult无响应的问题
- Android中Service类onStartCommand
- AJAX淋漓尽致的发挥(Google个性化主页 VS. Windows Live.COM)站在互联网浪尖上窃喜
- Android onTouchEvent, onClick及onLongClick的调用机制
- [Tip: C# in VS]Some quick tips for working on C# in VS
- OnTouch、OnClick、OnLongClick、OnFocusChange之间的调用关系
- 怎么让Html控件onclick事件和onserverclick事件同时有效
- service里面的onstart()方法和onStartCommand()方法的区别
- To be OnStart...
- Android Service生命周期 Service里面的onStartCommand()方法详解
- 333_onTouch和onClick
- input 控件里同时使用onclick onserverclick
- 调用startActivityForResult后,onActivityResult立刻响应,返回当前页onActivityResult不响应的问题
- The Poll based on Ajax -- Koma