Eclipse reports syntax error in JSP file, but application works

≡放荡痞女 提交于 2019-12-12 15:54:06

问题


I am inspecting codebase of one JAVA project, and I found that Eclipse shows error at the following lines:

<c:if test="${not empty queryClauses && ((activeRole eq 'ROLE_ADMIN' && querySearch.project.isPublic()) or (not querySearch.project.isPublic()))}">
    <div class="control-btns">
        <input class="btn btn-primary" type="button" id="updateQuery" value="<spring:message code="query.updateQuery" />"/>
        <input class="btn btn-primary" type="button" id="deleteQuery" value="<spring:message code="query.deleteQuery" />"/>
    </div>
</c:if>

Error is being showed at the following place:

querySearch.project.isPublic()

Error is:

Multiple annotations found at this line:
    - EL Syntax Error 
    - Encountered " "(" "( "" at line 1, 
     column 87. 
Was expecting one of: 
    "." ... 
    ">" ... 
    "gt" ... 
    "<" ... 
    ...

It was written by a co-worker, who has left the company, so I cannot ask Him about it. He assured that it is OK, but I feel bad about seeing an error in Java project.

From searching I found the following comment: https://stackoverflow.com/a/18417643/508654:

AFAIR, the latest version of the JSP EL allows calling methods, but your IDE is probably out of date and doesn't expect it. Eclipse is well-known for signalling errors that are not errors at all. Trust your app server.

Is this the same reason? Is there a work-around (by changing project code or Eclipse settings)? Will Eclipse be updated to reckognize the syntax?


回答1:


Seems to be a longstanding Eclipse validation bug:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=352491

As of writing (2 years after this SO question was raised), it still doesn't appear to have been properly fixed.

Also see the comments in this similar question.




回答2:


Not sure this line is causing problems, but I suspect you will have a problem with a double quote in a double quote (two lines have this issue) I changed it to have single quotes as follows:

From:
"query.updateQuery"
to:
'query.updateQuery'



来源:https://stackoverflow.com/questions/21160577/eclipse-reports-syntax-error-in-jsp-file-but-application-works

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