f:ajax 和 a4j:ajax 有什么区别吗? [英] Is there any difference between f:ajax and a4j:ajax?

查看:19
本文介绍了f:ajax 和 a4j:ajax 有什么区别吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

f:ajaxa4j:ajax 标签之间有什么显着区别吗?

Is there any significant difference between f:ajax and a4j:ajax tags?

我知道 Richfaces 4 中的 a4j:ajax 基于原生 f:ajax JSF2 标记,添加了一些在 f:ajax 中找不到的属性,如 onbeginonbeforedoupdatebypassUpdateslimitRenderstatusfocus 但是当我只需要发送一个简单的 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?

推荐答案

标签只是基本 的更方便的形式. 标签.您可以在此页面中找到所有差异的概述.

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.

execute 属性支持指向 的额外 @region 值.executerender 属性中的任何 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.

两个标签的oneevent属性的JS函数都会被调用3次(传入的data.status然后值为begin、<代码>完成、<代码>成功).当您只对其中之一感兴趣或想要区别对待它们时,这会迫使您使用 switchif. 分别通过 onbeginonbeforedomupdateoncomplete 属性使这更方便.另请参阅此相关问题: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?

如果您对这些增强功能中的任何一个都不感兴趣,那么使用 也应该完全没问题.性能差异是(并且必须)完全可以忽略不计,而不是选择其中之一的原因.

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天全站免登陆