EL语法错误是en

时间:2013-08-24 07:01:18

标签: jsp el

JSP页面中的以下语句在第一个等于出现时遇到错误。原因是什么以及我们如何解决这个问题。请尽快纠正我

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

页面加载成功。但是在JBOSS VISUAL STUDIO编辑器中说

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 个答案:

答案 0 :(得分:4)

在JSP EL中,==(或!=)通常用于比较字符串,而不是.equals()

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

AFAIR,JSP EL的最新版本允许调用方法,但您的IDE可能已过时并且不期望它。众所周知,Eclipse发出的信号错误完全没有错误。相信您的应用服务器。