Plugin JUEL
A recent addition to javax.el.ExpressionFactory have been the static methods newInstance() and newInstance(java.util.Properties).
With these methods, selection of a particular EL implementation is completely transparent to the application code. E.g., the first line of our Quickstart example could be rewritten as
ExpressionFactory factory = ExpressionFactory.newInstance();
Either of the new methods will determine a factory implementation class and create an instance of it. The first variant will use its default constructor. The latter will use a contructor taking a single java.util.Properties object as parameter. The lookup procedure uses the Service Provider API as detailed in the JAR specification. The JUEL jars have been setup accordingly. If on your classpath, the search will detect de.odysseus.el.ExpressionFactoryImpl as service provider class.
This way, JUEL can be used without code references to any of its implementation specific classes. Just javax.el.*...
Depending on your application's scenario, there may be several ways to register JUEL as default EL implementation.
- Place juel-2.1.x.jar into directory JRE_HOME/lib/ext. This will make the EL available globally for all applications running in that environment.
-
In a JEE5 environment, you may simply drop juel-2.1.x-impl.jar
into your /WEB-INF/lib directory. This will result in using
JUEL as EL implementation for that particular web application.
GlassFishObviously, this only works if the web container uses the new API method for factory creation. E.g, this is the case for GlassFish v2 Milestone 2 or later.
- Of cause, you can add juel-2.1.x.jar to your classpath manually.
Please refer to the section on Factory Configuration on how to configure an expression factory via property files.