JSTL fn:replace() function

The JSTL fn:replace() function returns the input string by replacing all occurrence of the specified string with the given string.

Syntax:

String replace(String inputString, String specifiedString, String givenString)

Example:

test.jsp

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


	
		fn:replace JSTL function example
	
	
		
		Given String: 


String after replacing JSTL to jstl:

web.xml


	
  
          test.jsp
  	


Output:

jsp example 60
 
Download this example.
 
Next Topic: JSTL fn:subString() function with example.
Previous Topic: JSTL fn:length() function with example.