Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 352491 - [JSF2.0] EL 2.2 - syntax error with a method expression
Summary: [JSF2.0] EL 2.2 - syntax error with a method expression
Status: REOPENED
Alias: None
Product: Java Server Faces
Classification: WebTools
Component: JSF Tools (show other bugs)
Version: 3.2.3   Edit
Hardware: PC Linux
: P3 normal with 4 votes (vote)
Target Milestone: Future   Edit
Assignee: Ian Trimble CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 315896 358160 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-07-19 13:05 EDT by Jarek Gawor CLA
Modified: 2021-11-10 02:38 EST (History)
15 users (show)

See Also:


Attachments
Patch applied to HEAD. (8.47 KB, patch)
2011-08-30 12:31 EDT, Ian Trimble CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jarek Gawor CLA 2011-07-19 13:05:41 EDT
Build Identifier: 

We have the following EL expression:

<h:outputText value="Something goes here: #{component.getClientId()}"  />  

Eclipse marks this with an error mark. The error mark has two descriptions:
1) "Expression must be a value expression but is a method expression"
2) "Syntax error in EL"

This expression should not be marked with an error as method expressions with parameters are supported in EL 2.2.



Reproducible: Always
Comment 1 Carl Anderson CLA 2011-07-26 15:43:32 EDT
IBM desires that this be fixed in the WTP 3.2.5 stream, if at all possible.  This is critical because WTP 3.2.x is supposed to support Java EE 6.  Part of the support of Java EE 6 is support for Java Server Pages 2.2/Expression Language 2.2, as per JSR 245.  As such, we would like to see this issue fixed in WTP 3.2.5, if possible.
Comment 2 Raghunathan Srinivasan CLA 2011-07-26 17:03:45 EDT
We will review this for a fix in 3.2.5 by 10/7, the date for the first RC build.
Comment 3 Cody Lerum CLA 2011-08-15 12:54:27 EDT
Seeing this Issue in Indigo as well.

Example

action="#{noteUtil.add(noteEntity)}"
Comment 4 Carl Anderson CLA 2011-08-15 15:09:55 EDT
Ian (or Raghu), if this has been accepted as a hotbug, can you update the title to [hotbug] (remove the _request part), as per http://wiki.eclipse.org/WTP/Hotbug_Policy ?

Also, the sooner that this is fixed in HEAD for WTP 3.4.0, the better.  Will the fix in HEAD not happen until M3?  Or can that be done sooner?  (Note: we want it fixed in 3.2.5, if possible, but a fix in HEAD would show us how big a change it is and thus the likelihood of it getting fixed in the R3_2_maintenance stream.)
Comment 5 Raghunathan Srinivasan CLA 2011-08-15 20:07:47 EDT
Accepted as a hotbug. We will checkin the fix to HEAD.  We are not able to commit to fixing this earlier than 10/7, but we will update status by the end of August.
Comment 6 Ian Trimble CLA 2011-08-24 13:17:38 EDT
Fix committed to HEAD at 2011/08/24 10:16AM PDT.
Comment 7 Szymon Ptaszkiewicz CLA 2011-08-30 05:55:05 EDT
(In reply to comment #6)
> Fix committed to HEAD at 2011/08/24 10:16AM PDT.

Ian, could you attach the patch that was committed to HEAD?
Comment 8 Ian Trimble CLA 2011-08-30 12:31:02 EDT
Created attachment 202436 [details]
Patch applied to HEAD.
Comment 9 Ian Trimble CLA 2011-08-31 14:57:06 EDT
Please advise whether or not you would like the patch back-ported to 3.2.5.
Comment 10 Szymon Ptaszkiewicz CLA 2011-09-01 10:37:52 EDT
(In reply to comment #9)
> Please advise whether or not you would like the patch back-ported to 3.2.5.

Yes, please see comment 4.
Comment 11 Ian Trimble CLA 2011-09-01 16:54:23 EDT
Fix submitted to R3_2_maintenance stream at 2011/09/01 01:51PM PDT.
Comment 12 Fabricio Lemos CLA 2011-10-19 16:08:37 EDT
I have this warning even with Eclipse Java EE Developer Tools Version: 3.3.1.v2011 07072200-7b7II1PFSK2WIlPwJBmNz-VWwVsTn

The code is:
<h:outputText value="#{testBean.sayHello()}" />

And the warning is:
Syntax error in EL	test.xhtml	/test-jee6/src/main/webapp/pages	line 17	Facelet Validator
Comment 13 Ian Trimble CLA 2011-10-19 16:30:29 EDT
Re-opened for investigation.
Comment 14 Michael Schierl CLA 2011-10-22 10:19:50 EDT
  Eclipse Java EE Developer Tools	
3.3.1.v201107072200-7b7II1PFSK2WIlPwJBmNz-VWwVsTn

Method expressions within parentheses (because of more complex expressions around them) do not work but create spurious EL Syntax errors.

This expression works (no EL Syntax Error):
<c:if test="${str.substring(1) eq str2.substring(1)}">

This expression does not:
<c:if test="${(str.substring(1) eq str2.substring(1))}">
Comment 15 Karsten Wutzke CLA 2011-11-04 06:44:48 EDT
Please note the following expression, which according to this

http://stackoverflow.com/questions/8004233/jsf-2-how-to-pass-an-action-including-an-argument-to-be-invoked-to-a-facelets-s/8004349#8004349

should be valid, too. Here's the BNF from chapter 1.19 of the EL 2.2 spec:

 ValueSuffix      ::= ‘.’ Identifier MethodParameters?
                    | ‘[‘ Expression ‘]’ MethodParameters?          <-- Look here
 MethodParameters ::= '(' (Expression (‘,’ Expression )* )? ')'

Please fix.
Comment 16 Ian Trimble CLA 2011-12-19 18:06:18 EST
(In reply to comment #12)
> I have this warning even with Eclipse Java EE Developer Tools Version:
> 3.3.1.v2011 07072200-7b7II1PFSK2WIlPwJBmNz-VWwVsTn
> The code is:
> <h:outputText value="#{testBean.sayHello()}" />
> And the warning is:
> Syntax error in EL    test.xhtml    /test-jee6/src/main/webapp/pages    line 17
>    Facelet Validator

I can't reproduce this (works fine for me). Please verify that you are using JSF 2.0 or greater, where this style of EL is valid.

 - Ian
Comment 17 Ian Trimble CLA 2011-12-19 18:09:09 EST
(In reply to comment #14)
>   Eclipse Java EE Developer Tools    
> 3.3.1.v201107072200-7b7II1PFSK2WIlPwJBmNz-VWwVsTn
> Method expressions within parentheses (because of more complex expressions
> around them) do not work but create spurious EL Syntax errors.
> This expression works (no EL Syntax Error):
> <c:if test="${str.substring(1) eq str2.substring(1)}">
> This expression does not:
> <c:if test="${(str.substring(1) eq str2.substring(1))}">

This should be logged as a separate issue against the jst.jsp component of the WTP project - it is reproducible in a simple Dynamic Web Project without a JSF facet installed (so, no JSF Tools functionality involved).

 - Ian
Comment 18 Ian Trimble CLA 2011-12-19 18:13:43 EST
(In reply to comment #15)
> Please note the following expression, which according to this
> http://stackoverflow.com/questions/8004233/jsf-2-how-to-pass-an-action-including-an-argument-to-be-invoked-to-a-facelets-s/8004349#8004349
> should be valid, too. Here's the BNF from chapter 1.19 of the EL 2.2 spec:
>  ValueSuffix      ::= ‘.’ Identifier MethodParameters?
>                     | ‘[‘ Expression ‘]’ MethodParameters?          <-- Look
> here
>  MethodParameters ::= '(' (Expression (‘,’ Expression )* )? ')'
> Please fix.

I'm not sure what "the following expression" refers to, but I am assuming it's something similar to "#{bean['method']('arg')}", which works fine for me. Please verify that you are using JSF 2.0 or greater.

 - Ian
Comment 19 Karsten Wutzke CLA 2011-12-19 19:10:48 EST
(In reply to comment #18)
snip
> 
> I'm not sure what "the following expression" refers to, but I am assuming it's
> something similar to "#{bean['method']('arg')}", which works fine for me.
> Please verify that you are using JSF 2.0 or greater.
> 
>  - Ian

Here's the code from a *Facelets sub view*:

<ui:composition ...>
  ...
      <h:commandButton value="Fortfahren"
                       action="#{acceptButtonBean[acceptButtonMethod](acceptButtonArgument)}"
                       onclick="#{rich:component('repo-remove-doc-popup')}.hide(); return true;">
        <f:ajax execute="@form" render="#{acceptButtonRenderId}" />
      </h:commandButton>
  ...
</ui:composition>

On the line action="..." Eclipse shows a warning on the opening parenthesis:

"EL syntax error: Unexpected symbol '('."

My Eclipse version is 3.7 and the project has the JSF 2.0 facet enabled.
Comment 20 Ian Trimble CLA 2011-12-19 19:36:40 EST
(In reply to comment #19)
> (In reply to comment #18)
> Here's the code from a *Facelets sub view*:
> <ui:composition ...>
>   ...
>       <h:commandButton value="Fortfahren"
>                       
> action="#{acceptButtonBean[acceptButtonMethod](acceptButtonArgument)}"
>                       
> onclick="#{rich:component('repo-remove-doc-popup')}.hide(); return true;">
>         <f:ajax execute="@form" render="#{acceptButtonRenderId}" />
>       </h:commandButton>
>   ...
> </ui:composition>
> On the line action="..." Eclipse shows a warning on the opening parenthesis:
> "EL syntax error: Unexpected symbol '('."
> My Eclipse version is 3.7 and the project has the JSF 2.0 facet enabled.

-----

Thanks for the extra info. I'm still not seeing the issue, but I think we may be closing on on why you still are. This was fixed in the HEAD stream (which will be released as WTP 3.4.0) and back-ported to WTP 3.2.5 (Helios stream). It is not targeted to be fixed in any 3.3.x (Indigo) stream.

So, more important than your Eclipse version, what is your WTP version?

Thanks,
 - Ian
Comment 21 Michael Schierl CLA 2011-12-20 08:04:39 EST
(In reply to comment #17)
> (In reply to comment #14)
> > This expression works (no EL Syntax Error):
> > <c:if test="${str.substring(1) eq str2.substring(1)}">
> > This expression does not:
> > <c:if test="${(str.substring(1) eq str2.substring(1))}">
> 
> This should be logged as a separate issue against the jst.jsp component of the
> WTP project - it is reproducible in a simple Dynamic Web Project without a JSF
> facet installed (so, no JSF Tools functionality involved).

Originally, when I wanted to report that bug, the bug tracker suggested I should add a comment to this bug (I guess because of words in the subject line), I did not notice this one is for JSF issues only. Sorry.

Opened a new bug at https://bugs.eclipse.org/bugs/show_bug.cgi?id=367180
for it.
Comment 22 Fabricio Lemos CLA 2011-12-20 09:47:41 EST
Ian, I have the error from comment 12 even with JSF 2.0 facet enabled. I´m using WTP 3.3.1. Guess I´ll have to wait for Eclipse Juno, right?
Comment 23 Karsten Wutzke CLA 2011-12-20 11:58:54 EST
(In reply to comment #20)
snip
> 
> Thanks for the extra info. I'm still not seeing the issue, but I think we may
> be closing on on why you still are. This was fixed in the HEAD stream (which
> will be released as WTP 3.4.0) and back-ported to WTP 3.2.5 (Helios stream). It
> is not targeted to be fixed in any 3.3.x (Indigo) stream.
> 
> So, more important than your Eclipse version, what is your WTP version?
> 
> Thanks,
>  - Ian

WTP version is 3.3.x (a mix of 3.3.0 and 3.3.1 components).
Comment 24 Ian Trimble CLA 2011-12-20 12:08:23 EST
I just checked the codelines, and the fix is also in 3.3.2 (not yet released).
Comment 25 Raghunathan Srinivasan CLA 2012-01-05 12:34:36 EST
Fixed in WTP 3.3.2 and 3.4.
Comment 26 Ian Trimble CLA 2012-01-06 14:20:53 EST
Was also fixed in 3.2.5.
Comment 27 Ian Trimble CLA 2012-01-06 14:21:41 EST
*** Bug 315896 has been marked as a duplicate of this bug. ***
Comment 28 Ian Trimble CLA 2012-01-06 20:09:01 EST
*** Bug 358160 has been marked as a duplicate of this bug. ***
Comment 29 Karsten Wutzke CLA 2012-03-08 07:08:47 EST
Guys, I have upgraded Indigo to

Eclipse Faceted Project Framework

Version: 3.3.2.v201201121600-377DH8s735735535DD9

but I still see a warning "EL syntax error: Unexpected symbol '('." on the EL expression:

#{acceptButtonBean[acceptButtonMethod](acceptButtonArgument)}

Both issues have been reported to GlassFish AND JBoss AS:

http://java.net/jira/browse/GLASSFISH-17628

and

https://issues.jboss.org/browse/AS7-2825

Both issues are long fixed.

Please do so, too. See here for the complete background:

http://stackoverflow.com/questions/8004233/jsf-2-how-to-pass-an-action-including-an-argument-to-be-invoked-to-a-facelets-s

PLEASE REOPEN!
Comment 30 Ian Trimble CLA 2012-03-08 15:41:45 EST
It'd be more appropriate to check the version of the "Eclipse Java EE Developer Tools" feature; the "Eclipse Faceted Project Framework" feature can always be at a different version than WTP.

This is working for me in Indigo SR2 (Eclipse Java EE Developer Tools, v3.3.2.v201111030500-7b7II1YFSK2WIuPRDEnExPV-RvTn).

Perhaps you could build a tiny example project, export it to a zip file and attach it here? There must be some aspect of this that I am not understanding or that isn't being stated.

I can't promise a fix (if I can actually find an issue) in any particular timeframe, but I would like to try to understand why one of us sees an issue and the other does not.

Thanks,
 - Ian
Comment 31 Karsten Wutzke CLA 2012-03-08 19:57:15 EST
OK, my version is: Eclipse Java EE Developer Tools  3.3.2.v201111030500-7b7II1YFSK2WIuPRDEnExPV-RvTn  org.eclipse.jst.enterprise_ui.feature.feature.group  Eclipse Web Tools Platform

Below is an example (it doesn't really make sense to compile a project for this). Imagine a data table showing files, their file names, their expiry date and a remove button. Because you need the same remove button (usually with a popup asking you for confirmation) you decide to go for a Facelets sub view, here called remove-button.xhtml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:ui="http://java.sun.com/jsf/facelets">
  
  <h:commandButton value="Remove" action="#{removeButtonBean[removeButtonMethod](removeButtonArgument)}" />

</ui:composition>

Then you list individual (personal) files and those kept for external companies:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                template="templating/page-layout-2col.xhtml">  

  <ui:define name="content-right">
    
    <h:form id="idoc-form">
      <h:dataTable value="#{repoHome.individualDocuments}" var="doc">
        <h:column>
          #{doc.fileName}
        </h:column>
        <h:column>
          #{doc.expiryDate}
        </h:column>
        <h:column>
          <ui:include src="subviews/remove-button.xhtml">
            <ui:param name="removeButtonBean" value="#{repoHome}" />
            <ui:param name="removeButtonMethod" value="removeIndividualDocument" />
            <ui:param name="removeButtonArgument" value="#{doc.id}" />
          </ui:include>
        </h:column>
      </h:dataTable>
    </h:form>
      
    <h:form id="edoc-form">
      <h:dataTable value="#{repoHome.externalDocuments}" var="doc">
        <h:column>
          #{doc.fileName}
        </h:column>
        <h:column>
          #{doc.expiryDate}
        </h:column>
        <h:column>
          <ui:include src="subviews/remove-button.xhtml">
            <ui:param name="removeButtonBean" value="#{repoHome}" />
            <ui:param name="removeButtonMethod" value="removeExternalDocument" />
            <ui:param name="removeButtonArgument" value="#{doc.id}" />
          </ui:include>
        </h:column>
      </h:dataTable>
    </h:form>
  
  </ui:define>
    
</ui:composition>

This is a relatively simple example that you can likely try in one of your environments. Just change the name of the template and the name of the ui-define. Then you only have to list whatever you have - hopefully you do have such an app. Anyway it should be easy to adapt.

The warning appears on the Facelets sub view on the commandButton line, opening parenthesis.

Please let me know if that worked.
Comment 32 Ian Trimble CLA 2012-03-09 11:52:44 EST
After much coaxing, I managed to see a generic "Syntax error in EL" warning. I am re-opening, but cannot promise a timeline for a fix.
Comment 33 Karsten Wutzke CLA 2012-03-09 12:05:13 EST
Thanks for reviewing and reopening this. Staying tuned...
Comment 34 Raghunathan Srinivasan CLA 2012-04-19 14:20:58 EDT
Removed the hotbug tag as the original request was addressed.
Comment 35 Mauro Molinari CLA 2014-07-17 06:23:06 EDT
I don't know if this is the same problem, but I have the following issue: in my main project, EL expressions with method expressions with string literal parameters produce a warning: "Syntax error in EL".

An example:
<h:commandButton action="#{bean.doSomething('FOO')}" />

The strange thing is that if I try to reproduce on a small Dynamic Web Project, this warning is not shown.
Both my main project and the test case project are dynamic web projects with the following facets: Dynamic Web Module 2.5 (Tomcat 7.0 runtime), Java 1.6, JavaScript 1.0, JavaServer Faces 2.1.
Of course, the project setup of the main project is much more complex, but without knowing the internals it's hard for me to guess what's the culprit.

Using Kepler SR2 (build id 20140224-0627) and WTP 3.5.2.
Comment 36 Marcel Stör CLA 2016-02-24 05:28:56 EST
This ain't fixed yet. With WTP 3.7.0.v201505072140 (Eclipse 4.5) the following fails:

${aliases[portfolioId.intValue()]}

Project facet is Dynamic Web Module 3.0 and Java 1.8.
Comment 37 Thomas Hoffmann CLA 2021-11-10 02:38:52 EST
This bug seems to be still open.

Eclipse complains about the method "divide" in this example:
<c:if test="${totalExpense <= (project.estimatedExpense.divide(60, 2, 4))}">

Error message:
Multiple annotations found at this line:
	- Encountered " "(" "( "" at line 1, 
	 column 49. 
Was expecting one of: 
    "." ... 
...

Eclipse doesn't recognize the method call "divide".