如何在JSF中的EL表达式#{}中写入硬编码的字符串值? [英] How to write a hardcoded string value inside EL expression #{ } in JSF?
本文介绍了如何在JSF中的EL表达式#{}中写入硬编码的字符串值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试执行以下操作:
I am trying to do the following:
rendered="#{billBean.company.equals("something")}"
但是问题是我无法在#{}
中写入"something"
.它将导致以下XML解析错误:
But the problem is I cannot write "something"
inside #{}
. It causes the below XML parsing error:
元素类型"h:commandLink"之后必须是属性说明>"或"/>".
Element type "h:commandLink" must be followed by either attribute specifications, ">" or "/>".
我该如何实现?
推荐答案
在EL内使用单引号(')指代普通的String
:
Use single quote (') to refer to a plain String
inside EL:
rendered="#{billBean.company.equals('something')}"
这篇关于如何在JSF中的EL表达式#{}中写入硬编码的字符串值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文