是否有F之间的差异:Ajax和A4J:AJAX? [英] Is there any difference between f:ajax and a4j:ajax?

查看:156
本文介绍了是否有F之间的差异:Ajax和A4J:AJAX?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有间任何显著差异F:AJAX A4J:AJAX 标签?

我知道A4J:从RichFaces的4 AJAX基于天然F:阿贾克斯像 onbegin ,<$ C $:阿贾克斯JSF2标签增加一些属性f中未发现C> onbeforedoupdate , bypassUpdates limitRender 状态焦点,但使用哪一个时,我只需要发送一个简单的Ajax请求或部分呈现?是F之间存在性能问题:Ajax和A4J:AJAX

I know about a4j:ajax from Richfaces 4 is based on native f:ajax JSF2 tag adding some attributes not found in f:ajax like onbegin, onbeforedoupdate, bypassUpdates, limitRender, status and focus but which one to use when I only need to send a simple ajax request or partial rendering ? Is there performance issues between f:ajax and a4j:ajax?

推荐答案

&LT; A4J:AJAX&GT; 标签的基本<$ C只是更方便的形式$ C>&LT; F:AJAX&GT; 标记。您可以在此页面。

The <a4j:ajax> tag is just the more convenient form of the basic <f:ajax> tag. You can find a nice overview of all differences in this page.

执行属性支持一个额外的 @region 值指向&LT; A4J :地区&GT; 。任何EL在执行渲染属性在当前请求,而不是在最初的要求得到解决。

The execute attribute supports an extra @region value pointing to the <a4j:region>. Any EL in execute and render attributes is resolved in current request instead of in initial request.

这两个标签的的OnEvent 属性的JS函数将被调用3次(传入的 data.status 有那么值开始完整成功 )。这将迫使你使用开关如果当你只关心其中的一个或想要把他们不同。该&LT; A4J:AJAX&GT; 使这更方便的与 onbegin onbeforedomupdate 的onComplete 分别属性。请参阅此相关的问题:<一href="http://stackoverflow.com/questions/7043840/jsf-2-how-show-different-ajax-status-in-same-input">JSF 2:如何表现出相同的输入不同的AJAX状态

The JS function of the onevent attribute of both tags will be invoked 3 times (the passed-in data.status has then the values begin, complete, success). This forces you to use a switch or if when you're only interested in one of them or want to treat them differently. The <a4j:ajax> makes this more convenient with onbegin, onbeforedomupdate and oncomplete attributes respectively. See also this related question: JSF 2: How show different ajax status in same input?

如果你不感兴趣的任何这些增强功能,然后用&LT; F:AJAX&GT; 应该是完全正常的为好。性能差异(而且必须是)完全忽略不计,不会选择一个比其他的原因。

If you're not interested in any of those enhancements, then using <f:ajax> should be perfectly fine as well. The performance difference is (and must be) totally negligible and not be the reason to choose one over the other.

这篇关于是否有F之间的差异:Ajax和A4J:AJAX?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆