i was wondering how to use/implement string contains method in jsf2 without using JSTL. please advise, thanks.
String contains method in jsf
<h:outputText value="#{'I love JSF'.contains('JSF')}" /> <!-- true -->
OR
<h:outputText value="#{myBean.text.contains('some_word')}" />
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')}"
© 2022 - 2024 — McMap. All rights reserved.
String
methods. So you can implement case insensitivecontains
feature like this.#{'i love JSF'.toLowerCase().contains('JSF'.toLowerCase())}
– Galibi