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.
fn:replace.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:replace> In JSTL</title>
</head>
<body>
<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>
</body>
</html>