Java Reference
In-Depth Information
Table 3-5. ELManager Methods
Method
Description
addBeanNameResolver
Registers a bean-name resolver
addELResolver
Registers an EL Resolver
addEvaluationListener
Registers an EvaluationListener
defineBean
Defines a bean with the local bean repository
getELContext
Returns ELContext that can be used for parsing and evaluating expressions
importClass
Imports a Java class
importMethod
Imports a Java method
importStatic
Imports a static field or method
mapFunction
Maps a static method to a function name
setELContext
Used to set the ELContext
setVariable
Assigns a value or expression to an EL variable
The following code listing demonstrates how to make use of the ELManager for importing a Java class into the
EL context.
ELProcessor el = new ELProcessor();
ELManager elMgr = el.getELManager();
elMgr.importClass("org.javaee7.chapter03.el.client.TestBean");
el.setVariable("bean", "new TestBean()");
Object result = el.eval("bean.num1 + bean.num2");
Incompatibilities with Previous Releases
Most of the EL 3.0 release is backward compatible; however, there are a few incompatibilities with previous releases,
mostly because of the nature of the new features. The list of incompatibilities is as follows:
T and cat .
The new keywords are
+ operator is overloaded for String concatenation.
The
null by default.
Non-primitive types are coerced to
Summary
Expression Language provides a binding between web views and server side logic. The Expression Language 3.0
release brings with it many great enhancements, including a stand-alone API, and more modern coding techniques
such as lambda expressions. Brushing up with the latest enhancements to the API will enhance any developer's
productivity, and it can also increase the availability of the API for those who wish to utilize EL within Java SE
applications.
 
 
Search WWH ::




Custom Search