Sunday, 11 December 2011

Tomcat 7 says that it supports EL 2.2 but methods calling with arguments doesn't work (solved)

Summary

Tomcat provides EL specification ($TOMCAT_HOME/lib/el-api.jar) and Jasper implementation (jasper.jar,jasper-el.jar). On Tomcat Homepage it says that it supports EL 2.2 specification which allows us to call from facelet methods of beans with arguments, eg mybean.mymethod(3). Unfortunatelly for me methods with arguments are recognized as properties from Tomcat. Obviously EL spec 2.2 doesn't work with Tomcat 7 (tested with apache-tomcat-7.0.23).

Solution

We will use the implementation of EL 2.2 from GlassFish. web.xml Override the expression factory implementation using org.apache.myfaces.EXPRESSION_FACTORY on MyFaces or com.sun.faces.expressionFactory on Mojarra:
        
        
 
  org.apache.myfaces.EXPRESSION_FACTORY
  com.sun.el.ExpressionFactoryImpl
  
 
  com.sun.faces.expressionFactory
  com.sun.el.ExpressionFactoryImpl
 
Note: another more violent solution would be deleting Jasper from Tomcat. pom.xml
  
   org.glassfish.web
   el-impl
   2.2.1-b05
  

No comments:

Post a Comment