How to write a hardcoded string value inside EL expression #{ } in JSF?

笑着哭i 提交于 2019-12-20 03:43:03

问题


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')}"


来源:https://stackoverflow.com/questions/17772791/how-to-write-a-hardcoded-string-value-inside-el-expression-in-jsf

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!