我正在尝试为链接创建一个条件,如果长度不是= 0然后显示描述但是我得到语法错误代码是:
<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" ...
答案 0 :(得分:3)
您无法像#{... #{... ...} ...}
中那样嵌套EL表达式。这没有任何意义。您应该将EL表达式#{... ...}
视为一个大范围,其中各种EL范围的变量和EL函数可以相互交互。
正确的语法是:
<c:if test="#{fn:length(pqfn:format('ACTUAL_LINK')) != 0}">
抛出了你得到的特殊异常,因为EL解析器意外地遇到了{
,而在此时预期会出现一个列出的字符序列。
答案 1 :(得分:2)
你似乎将一个EL表达式嵌套在另一个......这不起作用:
#{fn:length(#{pqfn:format('ACTUAL_LINK')}) != 0}
^
can't do this