How To Enable ExpressionLanguage-2.2 in Tomcat6 and Jetty6

EL-2.2 is part of JSR-245 MR2 (JSP-2.2) and therefor not included in Tomcat6 nor Jetty6. This will be part of Tomcat7 and Jetty7, but with a few manual steps, you can use EL-2.2 even in current containers.

EL-2.2 Implementation

Currently, the best Implementation we use is the one available from the glassfish project. An Apache implementation is ongoing and is currently available as a SNAPSHOT build, however we recommend to use el-api.jar and el-impl.jar from glassfish until it is final.


To make the 2 required jars available for your project, you can simply use maven:

    <!-- EL 2 -->

Apache's EL 2.2 implementation

The above code uses Sun's EL 2.2 implementation from Glassfish. If you want to use Apache's implementation, you have to use the following dependencies from the Apache SNAPSHOT repository:


However keep in mind that this implementation is only a SNAPSHOT build and thus you might run into some problems with it.

web.xml settings

In addition you have to configure the right expression factory implementation in the web.xml. For Sun's EL 2.2 implementation this is com.sun.el.ExpressionFactoryImpl and for Apache's implementation this is org.apache.el.ExpressionFactoryImpl. The following snippet shows the web.xml configuration for Sun's impl.


Tomcat preparation

Tomcat6 has to be prepared, otherwise it will crash with a Exception on container startup:

* 1. go to the tomcat home directory

* 2. remove tomcats el-api.jar from the classpath:

* 3. copy the EL-2.2 jars into ./lib (el-api-2.2.jar, el-impl-2.2.jar)

* 4. make sure that your WARs don't contain those 2 el jars!

HowToEnableEl22 (last edited 2010-05-25 18:52:18 by chello084114139213)