This Function use to check the Substring before value of a String.
This Program will show how to execute the <fn:substringbefore> in JSTL. As we declare syntax of library function. Then we declare the variables that will contain the stored value and implements the function as required. And a print tag that will print the output on the web browser. All the tags had also been closed as per mandate.
fn:substringBefore.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><fn:substringBefore> IN JSTL</title>
</head>
<body>
<center><h3>Example of Substring Before In JSTL</h3></center>
<c:set var=”str1″ value=”Welcome to Java server pages World.”/>
<c:set var=”str2″ value=”${fn:substringBefore(str1,’World’)}” />
<p><b><center><p>Real Sub String -: ${str2}</p>
</body>
</html>