< c:if>上的EL语法错误 [英] EL syntax error on <c:if>

查看:128
本文介绍了< c:if>上的EL语法错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为链接创建条件,如果长度不等于0,则显示说明,但是我遇到语法错误,代码为:

I am trying to create a condition for a link where if the length is not = 0 then show the description but I am getting a syntax error the code is:

<c:if test="#{fn:length(#{pqfn:format('ACTUAL_LINK')}) != 0}">
    <h:outputLink id="link1" value="#{pqfn:format('LINK_DESCRIPTION')}"/>
</c:if>

我收到的错误是:

Caused by: org.apache.el.parser.ParseException: Encountered " <ILLEGAL_CHARACTER> "{ "" at line 1, column 14.
Was expecting one of:
    "." ...
    ")" ...
    "[" ...
    "," ...
    ">" ...
    "gt" ...
    "<" ...
    "lt" ...
    ">=" ...
    "ge" ...
    "<=" ...
    "le" ...
    "==" ...
    "eq" ...
    "!=" ...
    "ne" ...
    "&&" ...
    "and" ...
    "||" ...
    "or" ...
    "*" ...
    "+" ...
    "-" ...
    "/" ...
    "div" ...
    "%" ...
    "mod" ...

推荐答案

您不能像#{... #{... ...} ...}中那样嵌套EL表达式.这没有任何意义.您应该将EL表达式#{... ...}视为一个大范围,其中各种EL范围变量和EL函数可以相互交互.

You can not nest EL expressions as in #{... #{... ...} ...}. This is not making any sense. You should see an EL expression #{... ...} as one big scope where various EL scoped variables and EL functions can interact with each other.

正确的语法是:

<c:if test="#{fn:length(pqfn:format('ACTUAL_LINK')) != 0}">

您抛出的特定异常是因为EL解析器意外遇到{,而此时已预期列出的字符序列之一.

The particular exception you got is thrown because the EL parser unexpectedly encountered an { while one of the listed character sequences was expected at that point.

这篇关于&lt; c:if&gt;上的EL语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆