This Function use to replace the given string in occurrence from the existing String.

In this Program the function <fn:replace> will replace the existing string with given string in condition of function syntax. We declare the library syntax of JSTL. Then after in Body section we declare two variables that will contain the stored value. Both variable contain the string value in next step we use replace function syntax. After declaring the function as required we close all the custom tags of Html In the last instance.


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

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



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



       <c:set var="str1" value="This Is The Example Of JSP."/>

       <c:set var="str2" value="${fn:replace(str1,'JSP', 'JSTL')}" />

       <br /><b><center><p>Real String : ${str2}</p>



        JSTL fn:replace() 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.