EL syntax error is en

给你一囗甜甜゛ 提交于 2019-12-13 16:13:26

问题


The following statement in JSP page encounters error near first equals occurence.What is the reason and how we can solve this problem.Please rectify me as soon as possible

${(fn:length(updateStock.todayDimensionStones)==i.count) && (!DimensionStones.status.equals('New')||!DimensionStones.isInspected.equals('No'))}

Page is loaded successfully.But in JBOSS VISUAL STUDIO editor says that

Multiple annotations found at this line:- Encountered "(" at line 1, 
     column 86. 
Was expecting one of: 
    "." ... 
    ">" ... 
    "gt" ... 
    "<" ... 
    "lt" ... 
    "==" ... 
    "eq" ... 
    "<=" ... 
    "le" ... 
    ">=" ... 
    "ge" ... 
    "!=" ... 
    "ne" ... 
    ")" ... 
    "[" ... 
    "+" ... 
    "-" ... 
    "*" ... 
    "/" ... 
    "div" ... 
    "%" ... 
    "mod" ... 
    "and" ... 
    "&&;&&;" ... 
    "or" ... 
    "||" ... 

    - EL Syntax Error 
    - Encountered "(" at line 1, 
     column 86. 
Was expecting one of: 
    "." ... 
    ">" ... 
    "gt" ... 
    "<" ... 
    "lt" ... 
    "==" ... 
    "eq" ... 
    "<=" ... 
    "le" ... 
    ">=" ... 
    "ge" ... 
    "!=" ... 
    "ne" ... 
    ")" ... 
    "[" ... 
    "+" ... 
    "-" ... 
    "*" ... 
    "/" ... 
    "div" ... 
    "%" ... 
    "mod" ... 
    "and" ... 
    "&&;&&;" ... 
    "or" ... 
    "||" ...

回答1:


In the JSP EL, == (or !=) is normally used to compare strings, not .equals():

${(fn:length(updateStock.todayDimensionStones) == i.count) && 
  (DimensionStones.status != 'New' || DimensionStones.isInspected != 'No')}

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.



来源:https://stackoverflow.com/questions/18415944/el-syntax-error-is-en

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