2

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" ... 
    "||" ...
4

1 回答 1

4

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

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

AFAIR,最新版本的 JSP EL 允许调用方法,但您的 IDE 可能已经过时并且不希望出现这种情况。Eclipse 以发出根本不是错误的错误信号而闻名。信任您的应用服务器。

于 2013-08-24T10:38:29.210 回答