How to write a hardcoded string value inside EL ex

2019-02-27 11:48发布

问题:

I am trying to do the following:

rendered="#{billBean.company.equals("something")}"

But the problem is I cannot write "something" inside #{}. It causes the below XML parsing error:

Element type "h:commandLink" must be followed by either attribute specifications, ">" or "/>".

How can I achieve this?

回答1:

Use single quote (') to refer to a plain String inside EL:

rendered="#{billBean.company.equals('something')}"


标签: string jsf el