i was wondering how to use/implement string contains method in jsf2 without using JSTL. please advise, thanks.
contains() method searches the sequence of characters in the given string. It returns true if sequence of char values are found in this string otherwise returns false.
The includes() method returns true if a string contains a specified string. Otherwise it returns false . The includes() method is case sensitive.
Java String contains() Method The contains() method checks whether a string contains a sequence of characters. Returns true if the characters exist and false if not.
The contains() method in Java is used to search the substring in a given String. Returns: If the substring is found in the specified String, then it returns a true value; otherwise, it returns a false value.
<h:outputText value="#{'I love JSF'.contains('JSF')}" /> <!-- true -->
OR
<h:outputText value="#{myBean.text.contains('some_word')}" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With