JSP EL、JSF EL 和统一 EL 的区别 [英] Difference between JSP EL, JSF EL and Unified EL

查看:38
本文介绍了JSP EL、JSF EL 和统一 EL 的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道表达式语言 (EL) 之间的详细区别.有 JSP EL、JSF EL 和统一 EL.

我想知道 EL 背后的历史以及 Java EE 应用程序中使用的最新 EL.EL 是最新版本所有视图技术通用的吗?

解决方案

  • 2002 年 6 月:JSTL 1.0 首次与 EL 一起引入.那些 ${} 的东西只适用于 JSTL 标签.它旨在调用 Javabean get 方法.

  • 2003 年 11 月:引入了 JSP 2.0,并且在 javax.servlet.jsp.el 包,它成为了标准 EL 作为 J2EE 的一部分1.4 标准.JSTL 1.1 没有 EL.现在 ${} 也可以在 JSP 模板文本中的 JSTL 标记之外工作.

  • 2004 年 3 月:在 javax.faces.el 包.那些 #{} 的东西只在 JSF 标签中起作用.与标准JSP EL ${} 的区别在于它不仅可以做get,还可以做set.这对于托管 bean 自动创建和设置输入组件的值是必需的.标准 EL ${} 也适用于 JSF 输出标签,但如果它们不存在于作用域中并且它们不会设置输入值,它们将不会自动创建 bean.p>

  • 2005 年 5 月:虽然仍在为应于 2006 年 5 月发布的新 JSP 2.1 做准备,但已从 JSF 中提取延迟的 EL #{} 并与标准 EL ${}javax.el 包.那时,它变成了统一 EL,它是随 JSF 1.2 引入的,后来成为 JSP 2.1 和 Java EE 5 标准的一部分.#{} 现在也可以在 JSP 标记中用于 get 值,但不能用于 set 值.${} 现在也可以在 JSP 中自动创建托管 bean,但不能自动创建 set 值.

  • 2006 年 11 月:Facelets 作为 JSP 的继承者被引入.它允许在 JSF 标签外的模板文本中使用 #{},代替没有任何属性的 .它还将 ${} 视为 #{},因此它们在 Facelets 中的行为相同.

  • 2009 年 12 月:EL 从 JSP 规范中提取出来,成为独立于 JSP 维护的独立规范,第一个版本是 EL 2.2 (JSR-245),类似于 JSP 2.2.主要的新功能是调用参数化方法,而不是仅在 #{} 语法中调用 Javabean getter/setter,例如#{bean.method(argument)}.此外,Facelets 成为 Java EE 6 标准的一部分.

  • 2013 年 6 月:引入了带有独立 EL 处理器的 EL 3.0,允许在普通 Java SE 应用程序中使用.其他主要的新特性是新的字符串连接运算符 +=,集合对象的新操作,包括流和 Lambda 表达式 ->(甚至在 Java 6/7 上!)并将常量导入 EL 范围.

I would like to know the detailed difference between the Expression Languages (EL). There is JSP EL, JSF EL and Unified EL.

I would like to know the history behind the EL and what the latest EL is that is used in Java EE applications. Is it the EL common for all view technologies in the latest versions?

解决方案

  • Jun 2002: JSTL 1.0 was introduced with EL for first time. It were those ${} things which works in JSTL tags only. It is designed to call Javabean get methods.

  • Nov 2003: JSP 2.0 was introduced and EL was moved from JSTL 1.0 to JSP 2.0 in javax.servlet.jsp.el package and it became standard EL as part of J2EE 1.4 standard. JSTL 1.1 was shipped without EL. Now ${} works outside JSTL tags in JSP template text as well.

  • Mar 2004: JSF 1.0 was introduced with deferred EL in javax.faces.el package. It were those #{} things which works inside JSF tags only. The difference with standard JSP EL ${} is that it doesn't only do get, but can also do set. This was mandatory for managed bean auto-creation and setting the values of input components. The standard EL ${} works in JSF output tags as well, but they won't auto-create beans if they don't exist in scope yet and they won't set input values.

  • May 2005: While still preparing for new JSP 2.1 which should be released May 2006, deferred EL #{} was extracted from JSF and combined with standard EL ${} in the javax.el package. At that point, it became unified EL which was introduced with JSF 1.2 and became later part of JSP 2.1 and Java EE 5 standard. The #{} can now also be used in JSP tags to get values, but not to set values. The ${} can now in JSP also auto-create managed beans, but not set values.

  • Nov 2006: Facelets was introduced as successor of JSP. It allowed for use of #{} in template text outside JSF tags, as substitute for <h:outputText> without any attributes. It also treats ${} as #{}, so they both behave the same in Facelets.

  • Dec 2009: EL was extracted from JSP specification and became a standalone specification which will be maintained independently from JSP, the first version being EL 2.2 (JSR-245), analogous with JSP 2.2. Main new feature is calling parameterized methods instead of only calling Javabean getters/setters inside #{} syntax, e.g. #{bean.method(argument)}. Furthermore, Facelets became part of Java EE 6 standard.

  • Jun 2013: EL 3.0 was introduced which comes with a standalone EL processor, allowing usage in a plain Java SE application. Other main new features are the new string concatenation operator +=, new operations for collection objects, including streams and Lambda expressions -> (even on Java 6/7!) and importing constants into EL scope.

这篇关于JSP EL、JSF EL 和统一 EL 的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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