fn:contains tag of Function Tag Library

What is "fn:contains" tag of Function Tag Library?

Explanation

"fn:contains" is a string function of JSP Standard Tag Library(JSTL). This function is used to check if the "string" contains the specified "subtsring". The function returns true if the substring is present and false if not.

Syntax:


boolean:fn:contains(string,substring)

In the above syntax the "string" and "substring" are of data type "String". It returns a boolean value.

Example :


<%@ taglib uri="http://java.sun.com/jsp/jstl/core"
prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions"
prefix="fn" %>
Does "liril" contains "i"::
<c:out value="${fn:contains(mylirilsoap,liril)}"/>
Result :

Does "liril" contains "i":: true

In the above example we checked whether the string "liril" has the substring "i", since it has "i" returns "true".

Ask Questions

Ask Question