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>
Dinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular Computer Notes 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.
Related Articles
Basic Courses
Advance Courses