Tired of old EL in JSP not being able to invoke methods on beans etc.
Can I use SpEL from Spring 3.0 in my JSP:s?
Tired of old EL in JSP not being able to invoke methods on beans etc.
Can I use SpEL from Spring 3.0 in my JSP:s?
It would be nice, wouldn't it, but no, JSP EL is a function of the JSP compiler. The best you could do would be to write a custom taglib which evaluated contained SpEL expressions, which would be rather clunky.
If an upgrade is possible, you can get method invocation support in the latest JSP EL/JEE implementations (e.g. JEE6 using Glassfish v3). The JUEL (an EL implementation) doc page suggests you can upgrade either by putting the classes into your JRE's ext directory or by putting them in WEB-INF/lib
and relying on the SPI mechanism (this depends on your container supporting this). The latest JUEL version supports method invocations.
I don't know enough about the Spring implementation to know how they plug in their EL support.
The upcoming Spring Framework 3.0.1 release adds a new spring:eval JSP tag that allows you to evaluate SpEL expressions from JSP pages. Future versions will add native integration with JSP 2.1 or > engines via a Unified EL adaption layer.
I use JBoss EL within Tomcat in the manner described by McDowell. I included the jboss-el.jar in WEB-INF/lib for my application and added this snippet to web.xml:
<!-- jboss el expressions allow method params -->
<context-param>
<param-name>com.sun.faces.expressionFactory</param-name>
<param-value>org.jboss.el.ExpressionFactoryImpl</param-value>
</context-param>