This Function tests the Input String starts with the given prefix or not.

This Program is a demo of Function <fn:startsWith> in JSTL. This function use to test that the input string starts from the given prefix or not. As per condition then we declare the syntax library of JSTL that will allow to access the JSTL functioning. Then after we declare variable and the syntax of function that will be execute and present the output on the web browser. In the end we close all the html tags

  fn:startsWith.jsp

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 

<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> 

<html> 

<head> 

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

</head> 

    <body> 

        <c:set var="str" value="Java Server Pages known as JSP "/> 

        <c:if test="${fn:startsWith(str, 'Java')}"> 

              <b><center><br /><p>String Starts with Java<p> 

       </c:if> 

    </body> 

</html>

       JSTL fn:startsWith() Function





About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), 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.