i was wondering how to use/implement string contains method in jsf2 without using JSTL. please advise, thanks.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
<h:outputText value="#{'I love JSF'.contains('JSF')}" /> <!-- true -->
OR
<h:outputText value="#{myBean.text.contains('some_word')}" />
回答2:
In addition you can use JSTL functions
Add this:
xmlns:fn="http://java.sun.com/jsp/jstl/functions"
And use it like this
render="#{fn:contains(myBean.myText, 'test')}"