org.apache.el.parser.ParseException: Encountered “(” at line X, column Y. Was expecting one of […]

非 Y 不嫁゛ 提交于 2019-11-29 11:43:53
BalusC

That can happen if your environment doesn't support EL 2.2. Invoking direct methods with parentheses/arguments like this

value="#{userbean.getAll()}" 

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:

  1. Use EL 2.1 compatible syntax, this works on Servlet 2.5 compatible containers:

    value="#{userbean.all}" 
    
  2. 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 as el-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 from javax.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:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!