This Function Returns the index within a string of the first occurrence of a substring.

    This function returns the index of a specified substring from the string. In this program we firstly   call the syntax library of JSTL functions for accessing them. After in the body section we declare attributes and the ‘var’ variables that will contain the storing value in it. The main occurrence will be to declaring the string function as we declare. After that close all the html tags. The function we call will present the output on the web browser.


<%@ taglib uri="" prefix="c" %> 

<%@ taglib uri="" prefix="fn" %> 



        <title>&lt;fn:indexOf&gt; In JSTL</title> 



         <c:set var="str1" value="Welcome To World Of Java Server Pages."/> 

         <c:set var="str2" value="Welcome to Java and JSTL Functions"/> 

         <b><center><p>The Output as Index (1) : ${fn:indexOf(str1, "Java")}</p> 

         <b><center><p>The Output as Index (2) : ${fn:indexOf(str2, "Functions")}</p> 



          JSTL fn:indexOf() Function

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.C.A, MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.