The below JSF snippet:
<p:dataTable value="#{userbean.getAll()}" var="user">
Throws this exception:
Encountered "(" at line 1, column 18. Was expecting one of: "}" ... "." ... "[" ... ">" ... "gt" ... "<" ... "lt" ... ">=" ... "ge" ... "<=" ... "le" ... "==" ... "eq" ... "!=" ... "ne" ... "&&" ... "and" ... "||" ... "or" ... "*" ... "+" ... "-" ... "/" ... "div" ... "%" ... "mod" ...
org.apache.el.parser.ParseException: Encountered "(" at line 1, column 18. Was expecting one of:
"}" ...
"." ...
"[" ...
">" ...
"gt" ...
"<" ...
"lt" ...
">=" ...
"ge" ...
"<=" ...
"le" ...
"==" ...
"eq" ...
"!=" ...
"ne" ...
"&&" ...
"and" ...
"||" ...
"or" ...
"*" ...
"+" ...
"-" ...
"/" ...
"div" ...
"%" ...
"mod" ...
at org.apache.el.parser.ELParser.generateParseException(ELParser.java:2142)
at org.apache.el.parser.ELParser.jj_consume_token(ELParser.java:2024)
at org.apache.el.parser.ELParser.DeferredExpression(ELParser.java:113)
at org.apache.el.parser.ELParser.CompositeExpression(ELParser.java:40)
at org.apache.el.lang.ExpressionBuilder.createNodeInternal(ExpressionBuilder.java:93)
at org.apache.el.lang.ExpressionBuilder.build(ExpressionBuilder.java:150)
at org.apache.el.lang.ExpressionBuilder.createValueExpression(ExpressionBuilder.java:194)
at org.apache.el.ExpressionFactoryImpl.createValueExpression(ExpressionFactoryImpl.java:68)
at com.sun.faces.facelets.el.ELText$ELTextVariable.apply(ELText.java:203)
at com.sun.faces.facelets.compiler.AttributeInstruction.apply(AttributeInstruction.java:101)
at com.sun.faces.facelets.compiler.UIInstructionHandler.apply(UIInstructionHandler.java:141)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:196)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
How is this caused and how can I solve it?
That can happen if your environment doesn't support EL 2.2. Invoking direct methods with parentheses/arguments like this
is only supported since EL 2.2, which goes hand in hand with Servlet 3.0. If you're getting this exception, then that can only mean that you're not deploying to a Servlet 3.0 compatible container, or that your webapp's
web.xml
is not declared conform Servlet 3.0, or that your webapp's/WEB-INF/lib
is littered with arbitrarily downloaded servletcontainer-specific JAR files originating from a completely different servletcontainer make/version which doesn't comply EL 2.2.There are basically 2 solutions:
Use EL 2.1 compatible syntax, this works on Servlet 2.5 compatible containers:
Upgrade to a Servlet 3.0 compatible container (Tomcat 7, Glassfish 3, JBoss AS 6, etc), or fix your
web.xml
to comply Servlet 3.0.You should also make absolutely sure that your webapp's
/WEB-INF/lib
does not contain any servletcontainer-specific libraries such asel-api.jar
and friends (see also this related question).Please note that this is not a JSF problem at all. You got an exception from
javax.el
/org.apache.el
package, not fromjavax.faces
/com.sun.faces
package. This means that it's an EL problem. It's basically saying that your EL syntax is wrong. It encountered an(
where it didn't expect that. The expected characters/operators are clearly listed thereafter.See also: