How to pass parameters in method expression – JSF 2.0
Problem
Since JSF 2.0, you are allow to pass parameter values in method expression like “#{bean.method(param)}“, but this feature is keep raising a “EL parsing error” in Tomcat server. For example,
1. Managed Bean
@ManagedBean(name="order") @SessionScoped public class OrderBean implements Serializable{ public String editAction(String id) { //... } }
2. JSF page
//...
<h:commandLink value="Edit" action="#{order.editAction(123)}" />
//...3. Parsing error
It will hits the following EL parsing error message :
An Error Occurred:
Error Parsing: #{order.editAction(123)}Solution
Actually, this so call “method expression parameters” are a feature of EL 2.2, which is not support in Tomcat by default. In order to use this feature, you have to get “el-impl-2.2.jar” from Java.net, and put it into your project dependencies folder.
pom.xml
<dependency> <groupId>org.glassfish.web</groupId> <artifactId>el-impl</artifactId> <version>2.2</version> </dependency>
Done, now your JSF 2.0 web application is supported the method expression parameters feature in Tomcat server.







i am using jboss
geting error that el does not support method with parameter
An Error Occurred:
/default.xhtml @54,75 action=”#{order.deleteAction(o)}” Error Parsing: order.deleteAction(o)}
+- Stack Trace
javax.faces.view.facelets.TagAttributeException: /default.xhtml @54,75 action=”#{order.deleteAction(o)}” Error Parsing: #{order.deleteAction(o)}
at com.sun.faces.facelets.tag.TagAttributeImpl.getMethodExpression(TagAttributeImpl.java:225)
hello sir
i added “el-impl-2.2.jar” to lib folder
but still i am getting the same error parsing for method expression
for the given line only
plz give me some hint to solve the problem as i am using
netbeans 6.8 with jsf 2.0
May be you can try include the J2EE library “javaee.jar” in your netbean class path, it contains another set of el implementation classes.
Hello,
i have the same problem with my project[and the same error]. Sorry, can you be more explicit and explain how to include “javaee.jar” in netbeans class path..?
i try to add javaee.jar from project -> right click proprietes -> Compile -> addJar, i put “javaee.jar” and pressed Save.I select clear and build,run and nothing, the same error. Why? :( I wrong somewhere?
And this file “pom.xml” with this code :
org.glassfish.web
el-impl
2.2
where should be added?
Tnx
Check these two articles for the Eclipse dependencies configuration.
1. http://www.mkyong.com/maven/maven-dependency-libraries-not-deploy-in-eclipse-ide/
2. http://www.mkyong.com/maven/eclipse-web-deployment-assembly-maven-dependencies-issue/
Hi MKYong,
I am running this application in weblogic server. I am also hitting the same error. method parameter passing is not working. I added j2ee.jar also. No Luck!!!
Can you help me? Any Idea?
Regards,
Ilaya
[...] Backing bean… @ManagedBean(name="user") @SessionScoped public class UserBean{ public String editAction(String id) { //id = "delete" } } Note If you are deploy JSF application in servlet container like Tomcat, make sure you include the “el-impl-2.2.jar” properly. For detail, please read this article – JSF 2.0 method expression caused error in Tomcat. [...]