问题
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