Home > jsf > JSF - ELException for follwing expression action="#{personService.addPerson(person)}"

JSF - ELException for follwing expression action="#{personService.addPerson(person)}"

July 24Hits:2
Advertisement

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?

Answers

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:

  • Invoke direct methods or methods with arguments / variables / parameters in EL
  • How to call a method with a parameter in JSF
  • Our EL wiki page

Related Articles

  • JSF - ELException for follwing expression action="#{personService.addPerson(person)}" July 24

    The below JSF snippet: <p:dataTable value="#{userbean.getAll()}" var="user"> Throws this exception: Encountered "(" at line 1, column 18. Was expecting one of: "}" ... "." ... "[" ... "

  • Get custom attribute of method executed in actionFebruary 12

    Here is my example metod [TestStep("Do something")] private void DoSomething() { } Each method which looks like the one above is executed in a way which requires logging the method parameters: private void LogStep(Action action) { string stepNam

  • call generic method in a non generic way October 24

    What's the best way to call a generic method when the type parameter isn't known at compile time, but instead is obtained dynamically at runtime? Consider the following sample code - inside the Example() method, what's the most concise way to invoke

  • Rewriting from headers in PostfixOctober 15

    I want to configure Postfix to replace the 'From' header in all forwarded/aliased messages with a custom email address, and the 'Reply-To' header with the original sender's address. Is that something that can be done with a simple configuration chang

  • Why high-tech OSs (like UNIX family) are mostly command based (rather than GUI based)? November 28

    DR-DOS, Plan, BSD, Sun Solaris, HP/UX, OpenServer.....and so on. Why high-tech OSs (like UNIX family) are mostly command based (rather than GUI based)? --------------Solutions------------- GUI is more difficult to build than CLI (command line interfa

  • CSS not getting included in PrimeFaces December 3

    I've done tutorial about Facelets templating. Now I've tried to create a page that isn't in same directory as the template. I've got problems with page style, because of styles are referenced with relative path like so: <link rel="stylesheet"

  • WeakAction ImplementationFebruary 9

    Here's my first attempt at creating a WeakAction using Expressions and Delegates. I would like it to be clear that this code was written after reading serveral blogs and taking snippets from various sources. The Program class at the bottom shows a fe

  • Trouble After Update, Removing Plugin

    Trouble After Update, Removing PluginFebruary 13

    I'm editing this site http://www.millermusicproductions.com/ currently and I updated WP 3.0.1 to 3.3.1. After updating, the page now is zoomed in compared to how it had been and I have no idea why. Here's another site with the same template that is s

  • Why does awk print on non-null strings and positive numbersMarch 8

    I've noticed some awk examples which use 1 instead of print to print $0 (eg. To conserve space, I normally use '1'. and on this site). Is this a documented / safe practice, or is is it subject to breaking in some versions; past, present or future? He

  • PageReference from embedded Visualforce page becomes inlinedApril 30

    I have a Visualforce page that gets embedded into the opportunity page layout. Part of the embedded page is a command button with an action defined in the controller to redirect the user to another page. Snippet from controller method referenced by t

  • How do I unit test an Apex controller method for dynamic components?August 30

    I have an Apex controller method that returns a Component.Apex.OutputPanel for use in a <apex:dynamicComponent /> tag. How do I do a unit test that asserts that the controller is outputting the correct HTML in the OutputPanel? That is, in my test I

  • How can I dynamically render required fields using a Dynamic Component

    How can I dynamically render required fields using a Dynamic ComponentDecember 12

    Background I have a Visualforce page on which I am rendering a lot of fields using a Dynamic Component (which is an Output Panel that contains all of the fields). The fields are added based on a selection of options in a multipicklist, and each time

  • Software to trim every ID3 fields of my mp3

    Software to trim every ID3 fields of my mp3February 25

    Many of my mp3s have ID3 fields that contain spaces at the beginning or at the end of the field. I'm looking for an application that: can trim (= remove start and end spaces) every ID3 field of each mp3 in the folder(s) I select walk the sub-folders

  • Programmatic Form Creation Based On DataJune 20

    Is it possible to dynamically create a form using data to control the types of input fields on the form using APEX/VisualForce and/or Javascript interop? In ASP.NET I'd programmatically add controls to the Page's controls collection. Those controls c

  • The Basics of Capybara and Improving Your Tests

    The Basics of Capybara and Improving Your TestsAugust 18

    Capybara is a web-based automation framework used for creating functional tests that simulate how users would interact with your application. Today, there are many alternatives for web-based automation tools, such as Selenium, Watir, Capybara, etc. A

  • Filtered lookup fields don't work in Visualforce when records wrapped in Object

    Filtered lookup fields don't work in Visualforce when records wrapped in ObjectDecember 5

    I have a grid Visualforce component that displays records as rows where fields are editable as apex:inputField. The component works for generic SObjects and uses fieldsets to defined editable fields. In one usage each record has two dependent Lookup

  • awk pattern with variable in a bash scriptMarch 17

    I have problem with command awk in bash I want to find pattern with variable, but it doesn't work. Can you tell me what's wrong with this line? awk -F" " "/$PWD/ {print $1,$3}" file.txt --------------Solutions------------- Since you ha

  • Simplify large sum of fractions to shortest representationMay 27

    I appear not to be able to find a way to simplify the sums of fractions like the following example to their shortest representation. For me shorteste representation means, to have as few as possible repeting terms. As a proxy to this I use LeafCount,

  • Find command returns different results when -print0 is addedJune 14

    When doing a search like find -type d, adding the -print0 argument right after the find command such as find -print0 -type d causes the search to return more results than without it. --------------Solutions------------- If you understand the && an

  • Very basic Java file reader/writerNovember 22

    I started learning the Java language about 10 days ago, reading Introduction to Programming Using Java by David J. Eck. I've made it halfway through chapter six in about 9 days. I realized I was going way too fast to learn efficiently, and so I'm goi

Copyright (C) 2017 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.454 s.